http://qs321.pair.com?node_id=420753


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

How about this, instead?

sub error { warn map { "$_\n" } @_; return undef; } # # and later # open FH, ">$_[0]" or return error($!, "not able to write to file $_[0]");

Replies are listed 'Best First'.
Re^2: calling sub and returning value from the same line
by gaal (Parson) on Jan 09, 2005 at 22:26 UTC
    return; is almost always preferable to return undef;.