I don't want to get hung up on loops as that is just one C-style construct under discussion. Also, I don't want to be in the position of having to defend C. Especially on a site called "PerlMonks".
That said, I agree most of what you said above. Although, I think that people who natively think in C don't have any problems reading
for ($i = 0; $i < $BLAH; ++$i) { ...}
. For a native C thinker to make a mistake with that construct is pretty rare.
But when you have the luxury of perl and you aren't forced to use C constructs, why not use for my $foo (@bar) { . . . }
I agree completely. It's the better solution. But my point is I wouldn't wring my hands over using the C construct if you don't normally make mistakes with it.
--
I used to drive a Heisenbergmobile, but every time I looked at the speedometer, I got lost.
|