Perl
What is perl?
Perl is a general purpose programming language originally developed for text manipulation and
now used for a wide range of tasks including system administration, web development, network
programming and GUI development and more.
now used for a wide range of tasks including system administration, web development, network
programming and GUI development and more.
- Perl is a stable, and cross platform programming language.
- Perl is an open source software.
- Perl was created by Larry Wall.
- Perl is listed in the Oxford Dictionary.
Features of Perl
- Perl take the best features from other languages.
- Perl works with HTML and other markup languages.
- The perl interpreter can be embedded into other systems.
- Perl supports both procedural and object oriented programming languages.
- Perl is interpreted.
Installation Process:
Step1: Open the browser and search for padre perl ide.
Step2: click on next button.
Click on finish.
Step3: Go to windows search and type padre perl ide and then open it.
Step4: sample program in perl. Perl file we have to save with .pl extension.
Code:
Print “Hello Perl”;
Output:
File IO operations in perl: File io operations are nothing but file handling like reading the data from the file, writing the data into
the file, renaming the file names and copying the files etc..
the file, renaming the file names and copying the files etc..
Reading text from a file: Inorder to read the file we have to follow the below syntax, here while giving path name we must use
the <(less than) symbol.
the <(less than) symbol.
Syntax:
open(NEW,”< path of the text file”);
#statements
close(NEW);
Code:
Output:
Writing into a file: For writing into a file we have to follow the below syntax, here while giving path/folder name we must
use the >(greater than) symbol.
use the >(greater than) symbol.
Syntax:
open(NEW,”>path of the text file”);
#statements
close(NEW);
Code:
Output:
Appending text to the existing file: It appends the text to the already existing text in the file.
Code:
Output:
Taking user inputs: For this we have to use <STDIN>.
Code:
Output:
Renaming a file: It renames the existing file name.
Code:
Output:
Copying of files: In this case we have to use source name and destination name.
Output:
Making a new directory: By using mkdir function we can create a new folder.
Code:
Output:
Arrays to string conversion: Inorder to convert arrays to string we have to use the join method.
Output:
String to array conversion: Inorder to convert strings to array we have to use the split method.
Code:
Output:
Perl iis configuration:
I have created sps site folder
Setting path for perl
Here in the above case the executable path is perl .exe path
Setting path for cgi
Browsing website
Comments
Post a Comment