in reply to Re^3: A question about method return values and error checking
in thread A question about method return values and error checking
On the other hand, of you didmy @names = $os->name( long => 1 ) or next; # No names
you would end up with lists of different lengths with the bare return;. Your solution puts the list elements back in scalar context, and thus avoids the actual question.my @names = map $_->name( long => 1 ), @oses;
Update: I remembered where it really bites people:
where the mismatch has now resulted in a transposition of keys and values.my %hash = (name => $os->name( long => 1 ), version => $os->version, );
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: A question about method return values and error checking (unnatural)
by tye (Sage) on Nov 05, 2015 at 16:03 UTC | |
by kennethk (Abbot) on Nov 05, 2015 at 21:10 UTC | |
by Anonymous Monk on Nov 06, 2015 at 11:15 UTC | |
|
Re^5: A question about method return values and error checking
by dsheroh (Monsignor) on Nov 06, 2015 at 11:03 UTC |