in reply to for loop syntax difference
And it's faster because Perl executes a foreach statement more rapidly than it would the equivalent for loop.I believe the "for" in the docs refers to a C-style loop (for($i=0;$i<10;$i++)) and the "foreach" refers to the more Perlish style (for $i (1..10)).
To prove that it is faster for you, you would have to benchmark it, as someone else already explained to you in another forum. It is considered good etiquette to mention that you already asked this question elsewhere.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: for loop syntax difference
by Taulmarill (Deacon) on Aug 28, 2009 at 14:05 UTC | |
by toolic (Bishop) on Aug 28, 2009 at 14:09 UTC |