In my innagural post I pointed out that a hash in scalar context will not behave as expected when tied, although it's tasty syntax: if (%my_hash) { ... do stuff ... }
I feel that's a bug and should be addressed.
As a bulletproof workaround, always use keys in scalar context thusly: if (scalar keys %my_hash) { ...do stuff... }
Matt
In reply to Re: How do I find out if a hash is empty?
by mojotoad
in thread How do I find out if a hash is empty?
by Pug
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |