David Wheeler asked:

How will while behave?
C<while> evaluates its first argument in scalar context, so:


    while <$fh> {...}    # Iterate until $fh.readline returns EOF?
More or less. Technically: call <$fh.next> and execute the loop body if that method
returns true. Whether it still has the automatic binding to $_ and the implicit
definedness check is yet to be decided.


    while <$iter> {...}  # Iterate until $iter.each returns false?
Yes.


    while fibs() {...}   # Infinite loop -- fibs() returns an
                         # iterator every time?
I suspect so.


    while <fibs()> {...} # I'm afraid to ask!
Usually an infinite loop. C<fibs()> returns a new iterator every time,
which <...> then calls C<next> on.

Damian

Reply via email to