in reply to Re: How to get the TOTAL length/size of an array?
in thread How to get the TOTAL length/size of an array?

use List::Util qw /reduce/; say reduce { $a + length $b } 0, @many_strings;

For cheap thrills, I browsed List::MoreUtils but nothing jumped out at me. This one is similar to yours (both programs produce 21):

use v5.38; use List::MoreUtils qw/reduce_0/; my @many_strings = ("abc", "cd", "e", "fg", "hi", "hello world"); say reduce_0 { $a + length $b } @many_strings;

I'm always out-classed by tybalt89 in these kinds of challenges, so I look forward to seeing what concoctions he comes up with when the USA time zone kicks in. :)

References Added Later

Perl core:

CPAN:

Other:

See Also