Sum and product of an array: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 443: | Line 443: | ||
$prod *= $_ foreach @list; |
$prod *= $_ foreach @list; |
||
Alternate |
Alternate (note: won't work on empty list) |
||
{{libheader|List::Util}} |
{{libheader|List::Util}} |
||
Line 451: | Line 451: | ||
my $s = sum @list; |
my $s = sum @list; |
||
Alternate |
Alternate (note: won't work on empty list) |
||
{{libheader|List::Util}} |
{{libheader|List::Util}} |