Perl ������� ��� linux

Perl Download

Getting started quickly

Perl runs on over 100 platforms!

We recommend that you always run the latest stable version, currently 5.34.0. If you’re running a version older than 5.8.3, you may find that the latest version of CPAN modules will not work.

Unix/Linux

macOS

Windows

Running Linux, Solaris, AIX, HPUX, or any other UNIX-like system?

Binaries

You probably already have perl installed. Type perl -v on a command line to find out which version.
ActiveState Perl has binary distributions of Perl for many platforms. This is the simplest way to install the latest version of Perl.

Source

Consider looking at App::perlbrew to help compile and manage Perl from source.

Find out more about the source code, development versions as well as current releases of the Perl source code.

Mac OS X

Binaries

Mac OS X already has Perl installed. Open a Terminal application (in the Utilities folder of your Applications folder) and run perl -v to find out which version.

ActiveState Perl has binary distributions of Perl for Mac OS X. This is the simplest way to install the latest version of Perl.

Source

Consider looking at App::perlbrew to help compile and manage Perl from source.

Find out more about the source code, development versions as well as current releases of the Perl source code.

Windows

Windows does not have Perl installed by default.

Binaries

ActiveState Perl ActiveState offers both a free community version and a commercially supported binary distribution of Perl for Win32 and Perl for Win64.

Strawberry Perl: A 100% Open Source Perl for Windows that is exactly the same as Perl everywhere else; this includes using modules from CPAN, without the need for binary packages. Help is available from other Windows Perl developers on the #win32 irc channel on irc.perl.org (see website for access through a browser).

Source

Consider looking at App::perlbrew to help compile and manage Perl from source.

Find out more about the source code, development versions as well as current releases of the Perl source code.

Источник

Downloading and Installing Perl in 2021

[This article is part of our Popular articles project to update Perl.com for contemporary practices]

If you’re reading this article, you’re likely looking for a simple way to download and install the Perl programming language. Or you already have Perl installed as part of your operating system, but it’s older than the currently-supported versions (5.32.1 or 5.30.3) and you’d like to use the latest and greatest features. The download options may seem daunting, especially if you’re new to computers or programming. We’ll take things step by step, and soon you’ll be on your way to writing your first Perl program.

A word of warning, though: Several of these steps (and usually Perl itself) require using your computer’s command-line or terminal interface.

The first step: Download pre-built

If you’re getting started in Perl development, you may only need a pre-built binary distribution. Further on, though, you might want to consider building your own, especially if you need to juggle different versions to support different environments or want to use a later version than is available pre-made.

For now, though, let’s consider the pre-built options. You have several, depending on what computer operating system you’re using.

Читайте также:  Linux узнать кто администратор

Microsoft Windows

The two main “flavors” of Perl for Windows are ActiveState Perl and Strawberry Perl. Which one you choose depends on what you plan to use it for.

ActiveState provides a free community edition of ActivePerl licensed only for development purposes. If you intend to do commercial work or want technical support beyond community forums, you’ll need to subscribe to a team plan or higher.

The free community edition is also 64-bit only, and as of this writing, only the earlier versions 5.28 (2018) and 5.26 (2017) are available, with an experimental 5.32 (2020) release licensed for any purpose. The latter is also currently only installable via the Windows command line; earlier versions use a standard Windows setup wizard.

Strawberry Perl is a Perl environment for Windows that strives to be as close as possible to Perl on Unix and Linux systems, where the language got its start. Besides the Perl binaries, it also includes a compiler, related tools, external libraries, and database clients. This is important as many modules for extending Perl’s functionality need a compiler. It’s also available in both 64-bit and 32-bit editions of the current 5.32 version.

What do I recommend? There’s no escaping Perl’s Unix heritage, so you’ll have an easier time with Strawberry Perl. That said, if you think you’ll be taking advantage of ActiveState’s commercial offerings of support and their ActiveState Platform for managing different language runtimes, you may want to give them a try.

Windows also has two Linux-like environments in the form of Cygwin and Windows Subsystem for Linux. Follow the Linux directions below to install Perl in one of these.

There is also the Chocolatey package manager for Windows, which provides an option for installing either ActiveState or Strawberry Perl.

Apple macOS

macOS comes with Perl pre-installed: version 5.18 (2013) on macOS Catalina 10.15 and 5.28 (2018) on Big Sur 11. But, Apple has said that scripting language runtimes are deprecated, and are only “included … for compatibility with legacy software.” You should consider installing your own.

Like Windows, ActiveState has a free community edition for developers. The Windows caveats above apply, except for a current Perl version 5.32—it’s “coming soon” as of this writing.

Your best bet is to install the Homebrew package manager in the macOS Terminal application (after installing its requirements), and then issue the command brew install perl . This will install the latest version of Perl, as well as give you instructions for making sure that installed Perl modules stay that way across updates by Homebrew.

Linux or another Unix-like system

Like macOS, most Linux and Unix systems come with Perl pre-installed, or installable using the operating system’s software package manager. Also like macOS, these are usually older versions provided for compatibility with other software provided by the OS.

To install your own on Linux, you can go the ActiveState route as above, or also use the Homebrew package manager. There are several requirements to install first, and then you can follow the directions for installing Homebrew and issue the command brew install perl .

For other Unix systems with an older version of Perl, I’m afraid you’re going to have to build from source as detailed below.

Next steps: Building your own with perlbrew or plenv

Perl’s source code (the instructions that build a program) is freely available and compiles on over 100 platforms. You can download it directly and build a version yourself, after installing any prerequisite packages used to build software on your operating system (see below). However, most Perl developers choose to use a tool to automate that process and manage different versions of Perl side-by-side. Enter perlbrew.

Читайте также:  Батареи для windows media player

Perlbrew requires an already-installed system version of Perl, but it can be as old as 5.8 (2002), which should cover most Linux and Unix systems in use today. Once you’ve installed your operating system’s build tools and followed the directions on the perlbrew home page, typing perlbrew install 5.32.1 followed by perlbrew switch 5.32.1 will install and switch to the latest version of Perl as of this writing. Installing older versions of Perl and switching between them use the same steps, e.g.:

I use an alternative, plenv, which uses a different mechanism to manage versions of Perl using the bash command shell. It also enables you to use different versions of Perl depending on which file system directory you’re working in. It’s set up using either Homebrew or git .

Windows users have the option of berrybrew, which acts much like perlbrew for Strawberry Perl with slightly different options.

Building from the source directly

If you feel you don’t need to manage multiple installations of Perl or you want to do things old-school, you can always download and build directly from the source code. Select “Download Latest Stable Source” from the Perl Download web page, then unarchive it into a directory.

You should always check the included README files for information on how to build on your system; there’s a generic one as well as specific README s for various platforms ( README.linux , README.macosx , README.win32 , etc.). Note that the README.macosx document applies to current versions of macOS, which was previously called Mac OS X; README.macos is for the “Classic” Macintosh operating system, unsupported since 2004.

On most Unix-like systems (including macOS), you can then configure, build, test, and install Perl by issuing the following commands:

This will build Perl with all default options for your system and install it in the /usr/local directory.

Up and running

Regardless of whether you’ve chosen to install a pre-built package or roll your own, you should now be able to issue the following at your command line:

…and receive a reply that looks something like this:

Источник

Быстрый старт в Perl

Perl — высокоуровневый интерпретируемый динамический язык программирования общего назначения, созданный Ларри Уоллом, лингвистом по образованию [Wikipedia] . Появился в 1987 году.

Этот язык программирования богат возможностями по работе с текстом, что определяет основную область его применения — манипуляции с текстом, в частности парсинг.

В этой статье будут описаны шаги по установке среды исполнения Perl, выбору средств разработки и созданию первой программы. В конце этого руководства вы найдете список источников, которые помогут быстро освоить основы Perl, а также изучить язык более углубленно.

Perl — это единственный язык, программы на котором выглядят одинаково до и после RSA-шифрования.

На момент написания этого материала актуальной версией интерпретатора является 5.22.0. Perl 6 готовится к релизу в 2015 году, но еще недостаточно документирован.

Язык программирования Perl крайне не рекомендуется брать в качестве языка для знакомства с программированием. Если вы абсолютный новичок — лучше начните с чего-нибудь менее губительного для вашего неокрепшего сознания. Серьезно, вот что говорил об этом языке Йон Риббенс:

PHP — это маленькое зло, созданное некомпетентными новичками, в то время как Perl — это большое и коварное зло, созданное умелыми, но извращёнными профессионалами.

К слову сказать, с PHP начинать тоже не стоит. А теперь ближе к делу.

Среда исполнения

На данный момент Perl официально поддерживается тремя ведущими платформами: Mac OS X, Unix и Windows. На первых двух из них среда исполнения Perl является предустановленной, и ее версию можно узнать через команду perl -v (свежую версию можно скачать здесь), а для операционных систем семейства Windows интерпретатор Perl доступен для скачивания на этой странице. Рекомендуется выбирать ActivePerl (дистрибутив от ActiveState) как самый распространенный.

Читайте также:  Очищаем компьютер без переустановки windows

Интегрированная среда разработки (IDE)

Perl, к сожалению, не очень популярен среди разработчиков сред разработки, поэтому на выбор вам предоставлено лишь небольшое количество специализированных инструментов.

Padre, the Perl IDE

Мультиплатформенная легковесная среда разработки, созданная специально для Perl и удобная для новичков. Помимо традиционных подсветки синтаксиса и автодополнения, имеет также встроенные инструменты рефакторинга. Кстати, Padre сама написана на Perl 5.

Среда разработки, основанная на Eclipse. Подойдет для тех, кто собирается углубиться в Perl. Также поддерживается всеми основными платформами, однако обладает большим функционалом: в частности, поддерживает инспекцию переменных, навигацию по краткой документации и средства отладки (для последнего необходимо скачивать дополнительный модуль).

Инструкция по установке на официальном сайте. Перед установкой вам необходимо иметь на компьютере Eclipse (версии, не ниже 3.6), среду исполнения Java (JRE) и интерпретатор Perl (инструкции по его установке даны выше).

Об установке дополнительных плагинов для EPIC можно почитать здесь.

Текстовые редакторы

Как и в случае с любым языком программирования, конечно же, вам предоставляется огромное множество мультиплатформенных текстовых редакторов на выбор: от предустановленных блокнотов до более удобных средств редактирования исходного кода с подсветкой синтаксиса, автодополнением и т.п. В частности, обратите внимание на:

  • KomodoEdit — урезанная версия коммерческой среды разработки Komodo IDE, разрабатываемая ActiveState (той самой, которая поддерживает дистрибутив ActivePerl), располагает функциями автодополнения, подсветки синтаксиса, множественных курсоров и подсказок из документации;
  • Vim — текстовый редактор, интерфейс которого может оказаться непривычным для Windows-пользователя; поддерживает подсветку синтаксиса;
  • Sublime Text — один из самых популярных инструментов редактирования исходного кода с подсветкой синтаксиса, автодополнением и т.п., функционал которого расширяется множеством существующих плагинов;
  • Notepad++ — легковесный текстовый редактор, отличающийся наиболее корректной, после KomodoEdit, подсветкой синтаксиса; функционал может быть расширен плагинами, однако специально для Perl их существует довольно мало.

CodeGround

Кроме того, если вы хотите только попробовать программирование на Perl и не хотите устанавливать дополнительное программное обеспечение на свой компьютер, вы можете воспользоваться сервисом CodeGround, предоставляющим доступ к онлайн-средам разработки с базовым функционалом для большинства языков программирования, в число которых входит и Perl.

Первый «Привет, мир!» на Perl

Традиционно предлагаем начать знакомство с новым языком со всем хорошо известной программы:

Сохраните эту строку в файле hello.pl и запустите только что созданную вами программу командой:

Однако прежде убедитесь, что исполняемые файлы Perl есть среди ваших переменных среды (переменных окружения), а также в том, что вы вызывается perl из папки с исходным файлом hello.pl . В случае успеха, вы увидите ожидаемое «Hello, world!»

Поздравляем, вы начали писать на Perl!

А дальше — в путь…

Отличное англоязычное руководство по языку программирования Perl для быстрого старта вы можете найти на сайте tutorialspoint.com. Помимо этого, существует официальный обучающий ресурс — learn.perl.org.

Среди русскоязычных руководств отметим перевод мультиязычного Учебника Perl. В нем переведены не все главы, однако в качестве основы ресурс вполне пригоден.

Если же вам не по душе изучение посредством чтения, вы можете посмотреть видео-уроки на YouTube в составе следующих плейлистов:

Если вам удастся найти хорошие видео-уроки по Perl на русском языке, обязательно напишите нам об этом в комментарии к этой статье или на почту chief@tproger.ru.

Естественно, вам не обойтись без официальной документации. Скачать оффлайн-версию в HTML и PDF формате можно на этой странице.

Среди книг для начала и продолжения обучения отметим:

  • «Изучаем Perl», Рэндал Л. Шварц, Том Феникс, Брайан Д Фой (июнь 2011);
  • «Modern Perl», chromatic (2014).

Список рекомендуемых к прочтению книг вы можете найти также здесь.

Спасибо за внимание и успехов в изучении Perl!

Хинт для программистов: если зарегистрируетесь на соревнования Huawei Cup, то бесплатно получите доступ к онлайн-школе для участников. Можно прокачаться по разным навыкам и выиграть призы в самом соревновании.

Перейти к регистрации

Источник

Оцените статью