in reply to Re:x2 Counting keys with defined or undefined elements in a hash
in thread Counting keys with defined or undefined elements in a hash

Not to mention that fact that grep constructs a list, that you then throw away after having counted the number of elements.

In the latest versions of perl (as of 5.8.0, IIRC), grep and map won't build a list in void context.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

Note: All code is untested, unless otherwise stated

  • Comment on Re: Re:x2 Counting keys with defined or undefined elements in a hash