Saturday, May 8, 2010

Basics of arrays in PERL

.

Defining an array:

@Myarray = qw(1st-Element 2nd-Element 3rd-Element);

OR

$myarray[0] = "1st-Element";

$myarray[1] = "2nd-Element";

$myarray[2] = "3rd-Element";

$#array returns the number of elements in an array

for (sort @myarray)

{ print $_ }

No comments: