Steve Grazzini wrote:
>
> On Thu, Nov 13, 2003 at 12:09:24PM -0800, John W. Krahn wrote:
> > Rob Dixon wrote:
> > > For the subscribers who don't already know,
> > > what are the differences between my
> > >
> > >   print for 1..5
> >
> > for iterates over the list 1..5 and sets $_ with each value and then
> > print is called for each item and print out the value in $_.
>
> Not exactly -- it iterates over the *range*, and the range operator
> doesn't need to generate a temporary list here.
>
>     print 1 .. $BIGNUM;      # creates list of $BIGNUM scalars
>     print for 1 .. $BIGNUM;  # creates/discards one scalar at a time
>
> This is a documented optimization w/r/t foreach() loops, but the same
> thing applies to the foreach() modifier.

What the code is optimised to is a touch OT, but I've never seen this
documented Steve. Can you direct me? What do you think is happening
under the hood for something like

  print for (0..0, 1, 2..5, func(6)..func(99))

?

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to