![]() |
|
Perl Monk, Perl Meditation | |
PerlMonks |
Re^4: C-style for loopby GrandFather (Saint) |
on Nov 15, 2008 at 21:26 UTC ( #723850=note: print w/replies, xml ) | Need Help?? |
I gave you a reason for preferring the Perl style for loop in general - fewer parts to go wrong. Eliminating a variable is not generally the important difference between two different for loop usages. Indeed:
Is generally a much better solution than:
because the range of the Perl loop is much easier to see and harder to get wrong. In general we can say what sort of for loop is better - Perl for loops. '"C-style" is bad because of useless $i variable' is not the reason however. Perl reduces RSI - it saves typing
In Section
Seekers of Perl Wisdom
|
|