in reply to Re^5: Dumb, non-question: How to return 'nothing'.
in thread Dumb, non-question: How to return 'nothing'.
No, the loop won't exit even if [ undef ] or [ 0 ] is returned. List assignment in scalar context returns the number of elements to which its RHS evaluates, meaning the number of elements in the array.
You'd be right that
while( my $next = $iter->() ) { my @next = @$next; ... }
is not equivalent to
while( my @next = @{ $iter->() } ) { ... }
But that's not the situation here.
The point was that
while( my $next = $iter->() ) { ($next) = @$next; ... }
is a complicated version of
while( my $next = @{ $iter->() } ) { ... }
which is just an expensive version of
while( my ($next) = $iter->() ) { ... }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^7: Dumb, non-question: How to return 'nothing'.
by BrowserUk (Patriarch) on Jun 18, 2011 at 07:31 UTC | |
by ikegami (Patriarch) on Jun 18, 2011 at 10:12 UTC | |
Re^7: Dumb, non-question: How to return 'nothing'.
by Anonymous Monk on Jun 18, 2011 at 06:47 UTC |
In Section
Meditations