#!/usr/bin/perl -w
#Define array
@myArray=(1,2,3,4,5,6,7);
#foreach loop
foreach $myVal(@myArray)
{
print($myVal);
print("\n");
}
#To reverse the array
print("Reverse Array \n");
foreach $revVal(reverse @myArray)
{
print($revVal);
print("\n");
}
#Directly print Array
print("@myArray \n");
Tuesday, October 14, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment