Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: what is the return value

by fishmonger (Pilgrim)
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 lurking in the Monastery: (5)
As of 2014-12-25 17:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (161 votes), past polls