return value - Perl: How to check what is being returned from a subroutine -


i have subroutine return 2 hashes when goes well. sub checkouts output of command , if matches pattern, returns "-1". there anyway check return of subroutine called it?

kinda like:

if (return_value == -1){    something}    else    go normal hashes 

you function should return references 2 hashes on success , nothing upon failure. can check truth value of function call.

sub myfunc {     %hash1;     %hash2;     return (\%hash1, \%hash2); }  $ref1; $ref2; unless (($ref1, $ref2) = myfunc()) {      print "something went wrong\n"; } else {      print "ok\n"; } 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -