http://www.perlmonks.org?node_id=1007787

Hi

I'm meditating if Perl should introduce an explicit keyword size (or count ¹) always return the number of elements of lists and arrays... (length is already taken and scalar is to overloaden)

so

size @a := scalar @a;

and

size (a..c) := scalar @{[a..c]}

I know "explicit is better than implicit" is more a Python dogma, but since even popes still fall into the scalar trap we should maybe consider "another way to do it" (best Perl tradition =).

Cheers Rolf

PS: I tried to provide an example implementation of size, something like

sub size([@$];@) { ... }

but was to lazy to fiddle around with prototypes.

Anyway IMHO a reliable implementation will need more parsing magic than prototypes can bring to avoid disambiguation.

¹) or whatever