perl wrote:
Is there a nice clean perl way to test to see if only one key of a hash
has data?

%some_hash = ( key1 => 1, key2 => 2 ); should fail the test
%some_hash = ( key2 => 2 ); should pass the test
%some_hash = ( key1 => 1 ); should pass the test

Thank you


print keys(%some_hash) == 1 ? 'yes' : 'no', "\n";


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to