Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: sub returning undef

by Stevie-O (Friar)
on May 24, 2004 at 14:36 UTC ( #355925=note: print w/ replies, xml ) Need Help??


in reply to sub returning undef

One problem I see is that 'undef' is an array of one element.

You should return an empty list: (). That will be treated as false by all conditionals (if unless while until).

--Stevie-O
$"=$,,$_=q>|\p4<6 8p<M/_|<('=> .q>.<4-KI<l|2$<6%s!<qn#F<>;$, .=pack'N*',"@{[unpack'C*',$_] }"for split/</;$_=$,,y[A-Z a-z] {}cd;print lc


Comment on Re: sub returning undef
Select or Download Code
Re: Re: sub returning undef
by exussum0 (Vicar) on May 24, 2004 at 14:42 UTC

      It would be more appropriate to die on error, and expect the calling code to trap it using:

      eval { # calls go here }; if ($@) { # exception handling here }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2015-07-05 06:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls