16 August 2009

Into to Perl

Al salamo alykom.

I know it is long time since i wrote the last post, but sure because i were so occupied, sorry.

Tody I want to share you a simple information I gained about a very powerful text manipulation language, Perl.

let's talk:

Perl is an old language that most of us heard about, but never use. although Perl have a simple syntax, you my use this syntax to declare a variable:

$var=10; # each line should ends up by ";"
$str="hello world";
@arr=(1, 2, 3, 4); # an array of integers

# to define hashs
%myMap={"name", "mohammed", "job" , "sw engineer"};

You see, it is a very simple languge

another example:

my $userName="ali";
print $userName; # will prints ali

yet antother example:

my @arr=("Egypt", "KSA", "UAE");
my $arrCount = @arr
for ($i=0; $i<$arrCount; $i++){
print "My Country is " . $arr[$i] . "\n";

Post a Comment