Thursday, August 28, 2014

Learning Perl

Perl shortcuts and commands 

perl -v  --> gives the version of the perl installed in the system

perldoc -f <function name >-->gives the usage of a function in perl.
eg :

perldoc -f print

perldoc -f substr

perldoc -q "any thing that you want to search"-->brings the details from the faqs .

perldoc perldoc--> gives the metadata of what is there in perldoc.

Print command :

this is the function that prints the statement in the console 

perl -e "print \"hello world"\";

Shebang lines :

The Perl program often begins with the shebang lines .(ie #!).it takes the following forms 

#! /usr/bin/perl
#! /usr/local/bin/perl
#! /usr/bin/perl -w
#! /usr/bin/env perl

The first two commands directly points to the perl executable that should run the program.
The third command has q -w that says it should run with global warnings .

use strict;
use warnings;
use diagnostics;