Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Test Presence of Data in Hash

by poolpi (Hermit)
on Jul 21, 2009 at 12:08 UTC ( #781934=note: print w/replies, xml ) Need Help??


in reply to Test Presence of Data in Hash

If you need to compare a hash against a (empty) hash ;)

#!/usr/bin/perl use strict; use warnings; use Data::Compare; my %h1 = ( 1 => 'boo', 2 => 'bar', 3 => 'baz' ); my $c = new Data::Compare( \%h1, {} ); print '%h1 is ', $c->Cmp ? '' : 'not ', "empty.\n";


hth,
PooLpi

'Ebry haffa hoe hab im tik a bush'. Jamaican proverb

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://781934]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2016-12-08 22:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (148 votes). Check out past polls.