On Sun, Mar 20, 2011 at 10:06:25AM +0200, Shlomi Fish wrote: > On Sunday 20 Mar 2011 05:43:38 Chris Stinemetz wrote: > > I am trying to code a foreach loop, that will add all occurrences of the > > element rlptxat that have the same elements cell, sect and chan. <snip> > > $record{dist}/6.6/8/2*10/10 : '' ;
Chris take this much of this calculation '6.6/8/2*10/10' outside the loop and precalculate the constant portion then inside the loop only calculate $record{dist}*$your_constant > > my @report = map > > "$_->{cell}\t$_->{sect}\t$_->{carr}\t$_->{chan}\t$_->{dist}\n" , @sorted; > > print @report ; > > This map will consume a lot of memory, better do it using a foreach loop. In what way will the use of map here use any more memory than a foreach loop? Thanks, Mike -- Satisfied user of Linux since 1997. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/