On Oct 16, 2007, at 5:55 PM, Travis McArthur wrote:
That's rather unusual but very useful, I don't know any other language that has built in hashing functionality to have that sort of instrumentation (regarding allocated buckets versus full buckets). I never knew that! Awesome stuff, I like how Perl pretty intelligentlyguesses what you want to know, which is nice. Thanks for bringing thisup Jay.
It also comes back as a plain zero if no buckets are used, because the hash is empty, so you can check to see if the hash is empty just by looking at it in scalar context.
Got some keys: alester:~ $ perl -le'print scalar %ENV' 26/64 This hash has no keys: alester:~ $ perl -le'print scalar %nonexistenthash' 0 We've deleted all the keys that used to be there: alester:~ $ perl -le'delete @ENV{keys %ENV};print scalar %ENV' 0 -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance