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.

-- 
Steve

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

Reply via email to