http://www.perlmonks.org?node_id=1043330


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