in reply to Re^3: mystery function & Odd number of elements in anonymous hash
in thread mystery function & Odd number of elements in anonymous hash
Many functions return the empty list or undef as some sort of error condition. Are you sure @values ought to be empty?
The function in question is an accessor to a hash of sorts. It may return no values (=key does not exist) or multiple values.
And how did adding a wrapper to force context solve the issue?
return scalar func(@_); returns $values[0] which is undef in the case of no values which is fine and doesn't maim my hashes.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: mystery function & Odd number of elements in anonymous hash
by JavaFan (Canon) on Jul 17, 2011 at 22:17 UTC | |
|
Re^5: mystery function & Odd number of elements in anonymous hash
by CountZero (Bishop) on Jul 18, 2011 at 16:24 UTC | |
by Anonymous Monk on Jul 18, 2011 at 21:18 UTC | |
by chromatic (Archbishop) on Jul 18, 2011 at 21:30 UTC |