Sunday, April 4, 2010

Perl

Perl is a scripting language. Scripts written in perl requires the perl executable to execute them.

Hello World Script:

#!/usr/bin/perl

print "Hello World!";

Capturing the output of command in perl variables

$output = `ls -l`;

Using system call to execute commands

system("cp src dst");

Difference b/w double quotes string and single quoted string

print "name is $name" : expands $name and prints it.

print 'name is $name' : prints $name as it is.

Perl is available for many systems; check http://www.cpan.org

No comments:

Post a Comment