What is PERL And How to Install Perl in Linux
PERL- Practical Extraction and Reporting Language (not an official acronym), is a stable and cross-platform language and was created by Larry Wall. Perl is an open source, general-purpose, interpreted language. Programs written in Perl are called Perl scripts. Perl supports both Procedural language and Object Oriented language and has powerful built-in support for text processing and have a collection of third-party modules. Perl language is mainly used for Web Applications, System Administration, Batch Processing, Applications which involving text processing and most command line applications. The features of Perl language are listed below.
Perl takes the best features from other languages, such as C, awk, sed, sh, and BASIC, among others.
Perls database integration interface DBI supports third-party databases including Oracle, Sybase, Postgres, MySQL, and others.
Perl works with HTML, XML, and other mark-up languages.
Perl supports Unicode.
Perl supports both procedural and object-oriented programming.
Perl interfaces with external C/C++ libraries through XS or SWIG.
Perl is extensible.
The Perl interpreter can be embedded into other systems.
How to install Perl in Linux?
Before proceeding with the installation of Perl in your Linux system, please have a check Perl is installed or not on your Linux system by running the below command.
# perl -v
If Perl is already installed, then you should see a message like:
Because every modern Linux distribution comes with Perl installed. If not installed, please follow the below steps to install Perl on your Linux system.
1) SSH to your server.
2) Change your directory to /opt by running the below command.
3) Download the zipped source code available for Unix/Linux by running the below command.
4) After download the zip file runs the below commands to extract and install Perl.
# tar -xzf perl-5.28.1.tar.gz
# cd perl-5.28.1
# ./Configure -de
# make test
# make install
This will install Perl in a standard location /usr/local/bin, and its libraries are installed in /usr/local/lib/perlXX, where XX is the version of Perl that you are using.
After completing the installation, run the command perl -v, if the installation successfully completed, it will display a message as we explained above.
You can write your Perl script in a text file and the text file should have the extension ‘.pl’. To run your Perl script run the below command.
Eg: #perl hello.pl