Main purpose to develop this highly structured language was text processing. Perl language helps to extract the required details from a text file and later convert it into another format. It is a versatile language, you can run it on different platforms i-e, Linux, macOS, Windows.
Run Perl Script on Linux Mint 21
To install the Perl programming language on Linux mint 21, follow the procedure as mentioned.
Update the apt cache before starting with Perl installation:
After updating, execute the command given below to start downloading:
As with the passage of time, Perl comes along with the updated versions. So, we need to check which version is installed in our system, type to confirm:
Next step is to verify if Perl interpreter is also installed in Linux Mint 21 system, run the command to get the path of Peal binary files:
Create and Run Perl Script on Linux Mint 21
Whenever you create Perl language files, the .pl extension will be used to save the file.
Let’s create and edit a Perl file using nano editor, as it is the easiest way, type in terminal. (Add a file name of your choice. The following command will create a file of the mentioned name and open it in the nano editor).
(Keep in mind the syntax of Perl language, the script will start from #!/bin/perl syntax. It shows you are working on a Perl file)
As the nano editor opens with the perlfile.pl file, you can add anything. It may be a code or you can just print simple line text.
Here is the short program to start with the Perl language. Write the following program in nano editor:
print(“Hello this is my experience with Perl language”);
Save this file and close the editor.
Open the command-line to run this file and check if our output is displayed or not by executing the following command:
Perl language is like C language, and easy to understand if they have knowledge of C and C++ language. The general purpose of developing this language was text processing as it comes with both procedural and object-oriented programming support. This article has given a brief step by step learning guide about the Perl language. We have learned how to install the Perl language on Linux mint 21. Furthermore, we have created a sample file with a short Perl script using nano editor and run it on terminal.