Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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.

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 romping around the Monastery: (11)
As of 2016-06-27 20:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (344 votes). Check out past polls.