in reply to Re^2: Search Engine Output needs sorting
in thread Search Engine Output needs sorting
You can never use the C-style method?
I would not say never use -- there are instances where it might make better sense*. However, for simple (i=0;i<max;i++)-type loops, Perl has a different method of specifying it: for my $i (0..$max-1).
This is a question of style and understanding. Just as not knowing idiomatic expressions (or using them incorrectly) can tag someone as "not from 'round here", using the C-style for loop in the general case may cause some to question how well you know Perl -- right or wrong.
On the other hand (and this may be heresy), if you are in a C shop, and your coding standards are written from a C point of view, I suppose that could be an argument for using the C-style for loop. Not necessarily a good argument, but an argument.
* - perhaps a time that you would want to use a C-style loop is if the increment is something other than 1, or if the exit test is something other than a simple comparison. However, this could be possibly written better in a different construct (while, for example).
--MidLifeXis
|
|---|