in reply to Re: Counting the number of items returned by split without using a named array
in thread Counting the number of items returned by split without using a named array
My bias goes towards either
or
as "most elegant".
It's both sufficiently short, although I'm not sure which one is easier to understand for the uninitiated reader :)
Just out of curiosity (it doesnt really matter in my case):
which one would be the more (CPU- and memory-) efficient one?
$entries = @{[ split ]};
or
$entries = () = /\S+/g;
as "most elegant".
It's both sufficiently short, although I'm not sure which one is easier to understand for the uninitiated reader :)
Just out of curiosity (it doesnt really matter in my case):
which one would be the more (CPU- and memory-) efficient one?
I.
In Section
Seekers of Perl Wisdom