boo_radley has asked for the wisdom of the Perl Monks concerning the following question:
my problem is that $foo{bar} may contain undef as a value, as well as a large array of text & etc.. What can $the_mysterious_errorcode be set to so that I can differentiate between a nonexistant $foo{bar} and one that's undef?sub check_foo { if (exists $foo{bar}) {return $foo{bar}} else {return $the_mysterious_errorcode} }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: detecting errors when a sub returns undef
by jeroenes (Priest) on May 01, 2001 at 10:54 UTC | |
|
Re: detecting errors when a sub returns undef
by Rhandom (Curate) on May 01, 2001 at 11:05 UTC | |
|
(tye)Re: detecting errors when a sub returns undef
by tye (Sage) on May 01, 2001 at 19:18 UTC | |
|
Re: detecting errors when a sub returns undef
by converter (Priest) on May 01, 2001 at 18:51 UTC |