I'm using rather often List::Util lately. I noticed that sum returns undef on an empty list:
$ perl -w -MList::Util=sum -le 'print sum' Use of uninitialized value in print at -e line 1.
Mathematically, it makes much more sense to return 0. Failing to do so forces me to either || 0 or use no warnings 'uninitialized'; and I wonder whether changing its behaviour is likely to break anything, although that seems highly improbable to me.
In reply to List::Util::sum() and empty lists... by blazar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |