Perl

Perl – Practical Extraction and Report Language is a free high-level, interpreted, dynamic programming language written by Larry Wall in the year 1987.Perl is very good for shell scripting and regualar expression.If you use GNU/Linux is default installed, on windows you have to install ActivePerl.The languages includes Perl 5 and 6, I use primary Perl 5(Perl 5 is also continue developing).The symbol of the Perl language is the Camel symbol.

 

Variable

$ for Scalar,@ for Array and % for Hashes, as example:

In Perl all variables are Scalars, you could store numbers and strings in the same value without convert.If you want to add a Scalar to another you have to concate two strings with “.”, but if you want to add two number you should use “+”.To access an element from the array you could use “$name[0]”, it starts from 0 to the last element, you get the last element with “$#name”.For manipulating a Perl Array look at this Post.And you could choose in  a big list of default variables.

 

Quoting

Be careful with quoting, the double quotes could interpolate other Scalars.

The name1 is “1” and name2 is “$a”.

 

Print

an simple “Hello World!” example:

 

Comparison

To compare the Scalars you could use them from this table:

compare type number string
equal == eq
 not equal  != ne
 less than  <  lt
 greater than  >  gt
 less or equal  <=  le
 greater or equal  >=  ge

 

loops

In Perl are more than one way to make a loop:

the first one is faster and faster to write, but the second has more possibility’s to change.

Do-While loop:

While loop:

 

Regex

Regular Expressions are very good implemented by Perl:

 

Optimizing

Perl is an interpreted language and if you need more performance you could use Inline code like C or you could take a look at my Benchmarks or at write fast code in Perl.

 

If you want to see some examples and solution from me see into my Category – Perl or if you want to see some special Tricks in Perl.

41 thoughts on “Perl”

  1. This article is truly a nice one it assists new web
    people, who are wishing in favor of blogging.

  2. Fastidious respond in return of this difficulty with firm arguments and describing all about that.

Leave a Reply

Your email address will not be published.

3 × 3 =