Name
sum
Synopsis
sum @LIST
Returns the sum of all items in the list. Note that sum
deals only with numerical list items
and will ignore any other list items. For example:
my @ll = qw(1 3 5 nate Person pizza man carl_everett dinosaur 6.54); my $sum_of_list = sum(@ll); print "$sum_of_list\n"; # Prints '15.54'
Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.