Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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 exploiting the Monastery: (9)
As of 2015-07-30 18:59 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 (273 votes), past polls