Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Just another Perl shrine
 
PerlMonks  

Re: Seeing if a hash has one arbitrary key

by jdporter (Canon)
on Feb 13, 2003 at 18:01 UTC ( #235044=note: print w/ replies, xml ) Need Help??


in reply to Seeing if a hash has one arbitrary key

That looks complicated (though it isn't really).
I'd probably use a temporary:

for my $c ( keys %h ) { my @attr = keys %{$h{$c}}; if ( @attr == 1 and $h{$c}{$attr[0]} == 1 ) { print "$c has a $attr[0]\n"; } . . .

jdporter
The 6th Rule of Perl Club is -- There is no Rule #6.


Comment on Re: Seeing if a hash has one arbitrary key
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2014-04-18 09:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (464 votes), past polls