in reply to Re^6: Dumb, non-question: How to return 'nothing'.
in thread Dumb, non-question: How to return 'nothing'.

The point was that while( my $next = $iter->() ) { ($next) = @$next; ... } is a complicated version of while( my $next = @{ $iter->() } ) { ... }

Not so. In the latter case when the iterator returns undef to terminate iteration, you will attempt to dereference that undef causing an error.

In the former, the loop terminates and the dereference is never reached.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^8: Dumb, non-question: How to return 'nothing'.
by ikegami (Patriarch) on Jun 18, 2011 at 10:12 UTC

    you will attempt to dereference that undef causing an error.

    ug, tired. Will strike that bit.