http://www.perlmonks.org?node_id=1012315


in reply to Re: While Loops
in thread While Loops

How about something like this?

foreach $a (0..@data-1) { print or do something ; } ## end of foreach

If you have the length of the array it knows then when to stop.