in reply to Re^4: A question about method return values and error checking
in thread A question about method return values and error checking
my @names = $os->name( long => 1 ) or next;
That seems more like a strawman to me. I just haven't run into code where people do list assignments in boolean context when using a sub that just returns a single scalar. It is an unnatural construct.
While using a scalar-returning sub as part of some list is done very often.
So subs that never return more than 1 scalar should never use return;. Subs that clearly return a list should avoid using return undef; to indicate failure.
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: A question about method return values and error checking (unnatural)
by kennethk (Abbot) on Nov 05, 2015 at 21:10 UTC | |
by Anonymous Monk on Nov 06, 2015 at 11:15 UTC |