in reply to for, foreach and $_...
If you need a counter, try this:foreach(@array) { # $_ is an alias, in turn, for $array[ 0 ], $array[ 1 ], ... $array[ + n ] }
foreach ( 0 .. $#array ) { # $_ 's value will be 0, 1, ..., (last index of @array) }
|
---|
In Section
Seekers of Perl Wisdom