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


in reply to Re: Perl oddities
in thread Perl oddities

In Perl 6, a hash in scalar context will return a reference to the hash, which will behave appropriately in boolean, numeric, or string contexts. (You'll have to call a special method to get the bucket filling information.) I'd like to note for the record, however, that the main reason hashes did not return the number of keys by default in numeric context in Perl 5 was that it was potentially a very expensive operation on DBM files and the like. But Perl 6 will gladly let you hang yourself by the foot there...