Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re^2: what is the return value

by fishmonger (Hermit)
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?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2015-12-01 07:27 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (795 votes), past polls