in reply to if multiple arg return or single fail?
Now, you can get the value of $x by using:
but I don't think there's an easy way to say "mysub returns at least 2 values, or a non-zero value" while at the same time declaring and assigning those values to variables all in one go. But if you take the declaration out:if ((my ($x, $y) = mysub ($args))[0]) {
Whether this is the most readable solution, I'm not so sure.my ($x, $y); if ((($x, $y) = mysub ($args)) != 1 || !defined($x) || length($x) != 1 + || $x != 0) { do stuff } else { # Triggered on a single 0 do other stuff }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: if multiple arg return or single fail?
by raybies (Chaplain) on Mar 07, 2011 at 17:49 UTC |