Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: calling sub and returning value from the same line

by Anonymous Monk
on Jan 09, 2005 at 21:48 UTC ( [id://420753] : note . print w/replies, xml ) Need Help??


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;.