[Melbourne-pm] scalar(keys %foo)
dean at fragfest.com.au
Mon Jun 1 23:46:24 PDT 2020
it fetches HvUSEDKEYS(hv);
which generally just fetches a structure member (it's a little more
complex if you're iterating over the has, or if it's tied)
On 2020-06-01 20:06, Mathew Robertson wrote:
> A question for the audience.
> Does "scalar(keys %foo)" materialise the list of keys, grabs its length, then throw away the memory? .. or is Perl smart enough to see that context, to understand that it just needs to count the keys ?
> Melbourne-pm mailing list
> Melbourne-pm at pm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Melbourne-pm