Update: The first line is why this node is garnishing negative XP. Its wrong for a few reasons..both reasons are within the unless...
First off unless will only evaluate to true if the EXPR inside returns something other than '0', an empty sting '', or undef
Second is the NULL. In this context I was attempting to use it as a alias for '0' which is what perl does, but that was wrong because if we do 'unless( values(%hash) );' that works as well. If we had applied 'use strict;' to this code it would have broke as NULL is a bareword in this situation.
Justifications:
First: I've been coding a bunch of C lately as should be readily apparent to whomever knows C in the bunch. I just didn't fully context switch to perl when whipping out this code.
Second: There was a thread ( I will attempt to find and link to) which raised an interesting situation where when calling values on a newly created hash ( cant remember if it was actually a ref to a hash or not), the values would be autovivified. In that situation I ended up suggesting doing 'unless( join('', values %hash) );' which was the only way to consistantly check to see if the hash really had anything in it.
Sorry for the bad code, but I guess we can stop downvoting this node, and simply use it as an example for .... something somewhere I'm sure..
# will print "no keys" if all values are undef..
print "no keys\n" unless( values(%hash) != NULL );
# to resest a hash..
%hash = ();
# or if you are paranoid
undef(%hash) && %hash = ();
Happy hacking
MMMMM... Chocolaty Perl Goodness.....