Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: what is the return value

by fishmonger (Friar)
on Jul 09, 2013 at 14:42 UTC ( #1043330=note: print w/ replies, xml ) Need Help??


in reply to Re: what is the return value
in thread what is the return value

You are correct, and there are several ways the OP could fix that problem. The first thing that I thought of would be to simply declare $in prior to the open call. The second was to use the ternary operator.

return open ($in, '<', shift ) ? scalar <$in> : undef; # using undef may or may not be desirable in this case


Comment on Re^2: what is the return value
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2015-07-07 04:58 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 (87 votes), past polls