Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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


Comment on Re: Test Presence of Data in Hash
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://781934]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2015-07-06 09:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (71 votes), past polls