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

my $len; $len += length $_ for @many_strings; say $len;
or:
use List::Util qw/sum/; say sum map {length $_} @many_strings;

Edit: Or, as documented in List::Util:

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

Replies are listed 'Best First'.
Re^2: How to get the TOTAL length/size of an array? (List Utils References)
by eyepopslikeamosquito (Archbishop) on Sep 21, 2023 at 08:18 UTC