|The stupid question is the question not asked|
List::Util - Bug in first?by strat (Canon)
|on Feb 18, 2008 at 14:06 UTC||Need Help??|
strat has asked for the
wisdom of the Perl Monks concerning the following question:
I just had a look at the function first in the Module List::Util and found the following code:
In my eyes, the undef; should be replaced by a plain return; to prevent getting a (true!) list with one value (of undef), which in scalar context is true, e.g.
Well, in the POD it is clearly stated that the first element is returned or undef - if not found. But since the syntax looks very similar to map and grep and the like, it might cause trouble without need if someone uses a list instead of a scalar to accept the result.
What do you think about?