Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Checking for defined-ness for a list

by elbie (Curate)
on Jul 25, 2001 at 22:58 UTC ( [id://99773]=note: print w/replies, xml ) Need Help??


in reply to Checking for defined-ness for a list

If you know that there are not going to be any extra keys, i.e. there are only going to be a combination of A, B and/or C but never D just count the nember of keys returned as follows:
print "At least one undefined!\n" unless( scalar( keys %$hash ) == 3 ) +;
Barring that, you might be able to sort out undesirebles from the list, or if you can sort such that you can guarantee the desired hashes are first, then just look at the element that would contain the last of the desirables:
print "At least one undefined!\n" unless( ( sort { ...some function... + } keys %$hash )[3] eq 'C' );

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-24 12:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found