in reply to Newbie realisation about
Also, most Perl programmers shy away from the "C-style" for loop. This is the C style:
for( $i=0; $i<20 ; $i++){ print "\$i = $i\n"; }
Whereas in idiomatic Perl, you'll typicall see things like the following:
for ( 0 .. 19 ) { print "$_\n"; }
The ".." is referred to as the range operator. It's faster than the C-style for loop and, once you get used to it, it's easier to read. See the "Range Operator" section in perlop.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (Ovid) Re: Newbie realisation about
by talexb (Chancellor) on Feb 02, 2002 at 04:58 UTC | |
by Ovid (Cardinal) on Feb 02, 2002 at 08:16 UTC | |
by tilly (Archbishop) on Feb 03, 2002 at 03:43 UTC |