From: Tim Hammerquist Date: 2002-08-29T10:31:51+09:00 Subject: Re: Converting Perl scripts to Ruby? Dan Sugalski graced us by uttering: > At 6:23 PM +0900 8/28/02, Tim Hammerquist wrote: >> foreach (1..10) { do_something } [ snip ] >>The biggest waste in the above code is that it creates a >>temporary anonymous list of 10 actual integers over which to >>iterate, all of which are tossed away, their value never >>actually processed. > > That turns out not to be the case. Constant ranges or lone > arrays in a foreach generate an iterator, so there's no > temporary list. There's code to make the 'fake' values in the > constant range iterator real if you reference them in ways that > would require them persist outside the foreach block. Yet Another Perl Optimization... Cool. Thanks. :) Tim Hammerquist -- As a computer, I find your faith in technology amusing.