4/13/2020

Perl Programming

** Perl Programming


` What is Perl?

- Create programs

- Handle Datebases and e-mails

- GUI(Graphical User Interface) development

- Networking and System Administration


` PERL vs. Shell Scripting

- Perl does not cause portability issues.

- Error handling is very easy on Perl.

- Writing long and complex programs on Perl is easy.

- Shell has fewer reusable libraries available compared to Perl's CPAN.

- Shell is less secure.


` How to Create PERL Script

- #! /usr/bin/perl

- Defining a Variable value : Storing values to a Variable in form of string and number : $variable = "value";

- Output in Perl : If you want a string or a value to display on the screen then you can use the print command : print("value to be printed");

- Input in Perl : If you want a use input to be assigned to a variable use : $variable = ;


` Points to Remember

- A comments should start with a # symbol.

- Every statement in Perl ends with a semi-colon.

- Perl is case-sensitive.

- You can use any text editor to write your PERL scripts.

- Save the script file in .pl extension.

- Do not use spaces while naming the Perl script file.


` Steps to creating a Perl Script

1. Create a file using any editor like vi.

2. Name script file with extension .pl.

3. Start the script with #! /usr/bin/perl

4. Write some code.

5. Save the script file as filename.pl.

6. Run the script using bash filename.pl.



`` Summary
 
- Perl is a general-purpose programming language originally developed for text manipulation.

- Now used for a wide range of tasks including system administration, web development, network programming, GUI development, and more.

- Perl files have .pl extension.

- There are three types of variable in Perl-Scalar, Lists and Hashes.