>>>>> "RD" == Rob Dixon <[email protected]> writes:
RD> On 26/05/2011 06:18, Uri Guttman wrote:
XL> for($i = 0; $i< @lines; $i++)
>>
>> first rule: don't use c style index loops when you can avoid them. that
>> line is much faster and more perlish as:
>>
>> foreach my $i ( 0 .. $#lines )
RD> It is also rare to need access to the array index (even if you think you
RD> do!). Perl is much more in its element if you loop over the elements of
RD> an array instead of its indices:
RD> foreach my $elem (@lines) {
i would normally have said that but he does need the index to setup the
inner loop index. as i said, the algorithm is all screwy with massive
duplicate summings.
uri
--
Uri Guttman ------ [email protected] -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/