Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^2: Cant use array with numbers??by robot_tourist (Hermit) |
on Sep 18, 2007 at 11:00 UTC ( [id://639611]=note: print w/replies, xml ) | Need Help?? |
I like to put an explicit name in instead of $_, like so:
Going back to the C/C++ style comparison, I also think $value is more readable than $array[$i], but that's a matter of opinion and/or of naming things well. But remember that $value is not available outside the for loop. If you're worried about knowing where you are in the array, I've found I don't need to worry most of the time or I can just create put 'my $i = 0;' before the loop and do $i++ each time round. How can you feel when you're made of steel? I am made of steel. I am the Robot Tourist.
In Section
Seekers of Perl Wisdom
|
|