TimeLinux1

Monday, April 11, 2011

Linux: Perl - 1

Perl:
-A language based on awk, C, sed and many others, it was created by Larry Wall in 1987.
-Initially its main intent was text processing, now it has grown to be a full blown language.
-Perl is smart and efficient. Elegance is left out for others..
-Perl has thousands of 3rd party modules, that enhance its smartness and efficiency.
-Perl authoritative source is www.cpan.org and its home page is www.perl.com.
-The best way to learn Perl is to work with it.

-The first line of perl scripts begin with #!/usr/bin/perl.
-this tells the shell to pass the script to perl for executing.
-To debug perl:
    . perl -w    -shows warnings
    . use strict    -imposes order
    . perldebug    -perl debugger
-perl documentation is in package perl-doc. Install it first before using Perl.
    # yum install perl-doc
-perldoc allows you to get easy documentation and also create your own.
-perldoc is similar to manual pages but specific to perl.
-Some perl cmds:
    # perl anyprog.pl        - run a program
    # perl -e 'anyprog.pl'        - runs perl cmd inplace on the cmd line.
    # perl -v            - version
   
-Some perl terms:
    . module    - self contained chunk of code
    . block        - zero or more statements delimited by curly brackets {}
    . list        - series of scalars, scalars being a type of variable
    . array        - variable holding a list in a definite order

...continued...

No comments:

Post a Comment