·  PERL – Introduction

 

- Info:

  - PERL stands for Practical Extraction Report Language.

  - PERL was created in 1986 by Larry Wall, linguist working as a systems administrator for NASA, for creating reports.

  - PERL was designed for fast text manipulation.

  - PERL is interpreted scripting language.

 

- Short Overview of Perl Syntax

  #Variables.

  $variable     = 9;

 

  #Arrays.

  @array        = (1,2,3);                 

  $array[0]     = 1;

 

  #Hashes.

  %hash         = (Jack=>23,Jill=>[1,2,3]); 

  $hash{"Jack"} = 23;

 

  #Reference.

  $address      = \$variable;

  $content      = $$address;

  $address      = \@array;

  $address      = \%hash;

 

  #Calling function from another package.

  myPackage->func(1,2);   #myPackage is inserted as first argument.

  myPackage::func(1,2);

 

  #Classes.

  Person->func(1,2);      #Class method call.

  $Jim->new();            #Create object $Jim of class Person.

  $Jim->func(1,2);        #Object method call.

 

- Prefered Highlighting:

  #Comment.

  while(1==1) {

    $text = "Hello";

    print($text);

  }

 

 

 

Red

Green

Blue

Example

 

Comment

0

128

0

#Comment.

 

Keyword

0

0

255

while

 

Variable

200

0

0

$text

 

Strings

200

0

200

"Hello"

 

Numbers

200

0

200

1

 

Other

0

0

0

print