Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^7: Dumb, non-question: How to return 'nothing'.

by BrowserUk (Pope)
on Jun 18, 2011 at 07:31 UTC ( #910309=note: print w/ replies, xml ) Need Help??


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.


Comment on Re^7: Dumb, non-question: How to return 'nothing'.
Download Code
Re^8: Dumb, non-question: How to return 'nothing'.
by ikegami (Pope) on Jun 18, 2011 at 10:12 UTC

    you will attempt to dereference that undef causing an error.

    ug, tired. Will strike that bit.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://910309]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (9)
As of 2014-08-20 05:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (105 votes), past polls