in reply to Re: looping through variables
in thread looping through variables
print "Site $_ is $sites[$_-1]\n" for 1 .. 3;
would be better written as
print "Site $_ is $sites[$_-1]\n" for 1 .. @sites;
or
print "Site ", $_+1, " is $sites[$_]\n" for 0 .. $#sites;
Noone said the index needed to be printed:
print "$_\n" foreach @sites;
|
|---|