logo codesdope

Introduction


Perl is a high-level programming language created by Larry Wall in 1987. It is widely used for text manipulation. Some of the features of Perl are:

  • A large number of third-party modules are available for use in Perl from Comprehensive Perl Archive Network (CPAN).
  • Perl can be integrated with a number of databases like MySQL, Oracle, Sybase, Postgres and others.
  • Perl takes best features of many other languages including C, awk, sed, bash, COBOL, Lisp, Ada, Python and BASIC-PLUS.
  • Perl also supports object-oriented programming.
  • Perl includes powerful tools for processing text that make it ideal for working with HTML, XML, and all other mark-up and natural languages.
  • Perl also supports Unicode.
  • Perl interfaces with external C/C++ libraries through XS or SWIG.

How to run Perl


In Windows


1. Download Perl padre or you can go with Strawberry Perl.

download Perl for windows


download Perl for windows

2. Install it.

3. Open it from installed apps ( Padre, the Perl IDE OR Perl(command line) (for Strawberry Perl) ).

4. Type the Perl code given below and save it with .pl extension (hello.pl in our case).

print "Hello World\n";
writing Perl codes in windows
saving with .pl extension in windows

7. Click Run -> Run script and then you can see 'Hello World' printed on the screen

run Perl codes from file in windows
Hello world in Perl

For Strawberry Perl, enter the command perl hello.pl.

Hello world in Perl


Hello world in Perl

Now you know how to run Perl codes and you are ready to go for the next chapter.

In Linux


1. Open terminal ( ctrl+alt+T ).

Check whether Perl is installed in your computer by entering the command perl -v.

checking version of Perl

2. Open a new file with .pl extension ( name of our file is hello.pl ) in your favourite text editor ( we are using gedit ).

gedit hello.pl

open file with .pl in gedit

3. Write the Perl code given below and save it.

print "Hello World\n";

4. To run this code, enter perl hello.pl (it means that you have to enter 'perl filename').

run perl code in terminal

Now you can see Hello World printed on the screen.

You are now ready to go for the next chapter.

Share what you know
Doubt? Ask question
Close

Welcome.please sign up.

Close

Welcome.please login.