good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
The question is which one should I use to accomplish my requirement? Neither. The both return undef if no argument is passed, or if the first argument is 0, "0", or the empty string. What I would do is: Now, if you want to return right away if nothing is passed as well, make the first line in the method:
Note that I didn't do "return undef". If you do that, and you call the sub in list context, it will return a *true* value (a one element list). But a return without arguments will return an empty list in list context, and undef in scalar context. Abigail In reply to Re: To || or not to or and why.
by Abigail-II
|
|