Popcorn Dave has asked for the wisdom of the Perl Monks concerning the following question:
While perusing some perl code in 2600 magazine ( which the author said was perhaps crude ) I came across a section where he used:
for ($i=1; $i <= @ARGV; $$i++)
and I thought, why not do:
<P> $count = @ARGV; for (1..$count)
So my question is: Is there any advantage to doing the code my way? I think mine is a bit more readable, but is it any more efficient?
Some people fall from grace. I prefer a running start...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: for ( ; ; ) vs for ( .. )
by broquaint (Abbot) on May 23, 2002 at 16:37 UTC | |
|
(jeffa) Re: for ( ; ; ) vs for ( .. )
by jeffa (Bishop) on May 23, 2002 at 16:43 UTC | |
|
Re: for ( ; ; ) vs for ( .. )
by Elian (Parson) on May 23, 2002 at 17:16 UTC | |
by demerphq (Chancellor) on May 23, 2002 at 17:57 UTC | |
by Elian (Parson) on May 23, 2002 at 18:08 UTC | |
by lestrrat (Deacon) on May 23, 2002 at 22:09 UTC | |
by Elian (Parson) on May 24, 2002 at 01:02 UTC | |
by demerphq (Chancellor) on May 24, 2002 at 08:55 UTC | |
by Elian (Parson) on May 24, 2002 at 20:04 UTC | |
| |
|
Re: for ( ; ; ) vs for ( .. )
by Joost (Canon) on May 23, 2002 at 16:33 UTC | |
by Albannach (Monsignor) on May 23, 2002 at 17:18 UTC | |
by Popcorn Dave (Abbot) on May 23, 2002 at 18:01 UTC |