> >> my @array = (1 .. 100);
> >> my $counter = 0;
> >>
> >> for (@array) {
> >> print "index -> $counter element -> $_\n";
> >> $counter++;
> >> }
> >
> > The other approach is to use a C-style for-loop.
>
> Is there any given advantage of one over the other in
> terms of performance and/or maintainability?
AFAIK C style tends to be slower, as it's got an extra
comparison. The Perl 'foreach' is optimized for looping
over arrays, and incrementing a counter should only take
a few ops.
Jonathan Paton
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]