diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/List/Util.pm')
-rw-r--r-- | Master/tlpkg/tlperl/lib/List/Util.pm | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Master/tlpkg/tlperl/lib/List/Util.pm b/Master/tlpkg/tlperl/lib/List/Util.pm index 033ef505c0f..5988aa914ec 100644 --- a/Master/tlpkg/tlperl/lib/List/Util.pm +++ b/Master/tlpkg/tlperl/lib/List/Util.pm @@ -12,14 +12,20 @@ use strict; require Exporter; our @ISA = qw(Exporter); -our @EXPORT_OK = qw(first min max minstr maxstr reduce sum shuffle); -our $VERSION = "1.25"; +our @EXPORT_OK = qw(first min max minstr maxstr reduce sum sum0 shuffle); +our $VERSION = "1.27"; our $XS_VERSION = $VERSION; $VERSION = eval $VERSION; require XSLoader; XSLoader::load('List::Util', $XS_VERSION); +sub sum0 +{ + return 0 unless @_; + goto ∑ +} + 1; __END__ @@ -164,6 +170,11 @@ C<undef> being returned $foo = sum 0, @values; +=item sum0 LIST + +Similar to C<sum>, except this returns 0 when given an empty list, rather +than C<undef>. + =back =head1 KNOWN BUGS |