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


in reply to Re: calling sub and returning value from the same line
in thread calling sub and returning value from the same line

Another alternative is to replace the "and" operator with a comma:
open FH, ">$file" or error("msg"), return undef;
If you do this, you must use parentheses to call the "error" function.

--Dave
Opinions my own; statements of fact may be in error.