Pages

Thursday, November 10, 2011

Array Perl



To get the index and item

for my $i (0 .. $#x) {
print "$i: $x[$i]\n";
}
To get the last item in array
. $array[$#array] .
To get the total number of array

.  scalar @array .
To get the max index in array
$#array
To Output the item of array
foreach (@array)
{
$element = $_;
print " $element\n"

}




References :
1. http://www.tutorialspoint.com/perl/perl_arrays.htm
2. http://perlmeme.org/howtos/data_structures/arrays.html

0 comments:

 

site weekly hits