in reply to How to get the TOTAL length/size of an array?
G'day Polyglot,
$ perl -E ' my @many_strings = ("abc", "cd", "e", "fg", "hi", "hello world"); $" = ""; say length "@many_strings"; ' 21
Although, I'd generally localise changes to special variables in the smallest scope possible:
$ perl -E ' my @many_strings = ("abc", "cd", "e", "fg", "hi", "hello world"); { local $" = ""; say length "@many_strings"; } ' 21
Update: I checked to see if anyone had used that prior to posting. Obviously, I didn't look closely enough: after posting I noticed ++hippo had already posted the same solution.
— Ken
|
---|