Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: equal keys in a hash

by Tanalis (Curate)
on Jun 26, 2003 at 16:40 UTC ( [id://269306]=note: print w/replies, xml ) Need Help??


in reply to equal keys in a hash

In any normal hash, no two keys can be the same anyway. Assuming that you mean that you need to check that a key doesn't already exist, you can use exists, like this:
my %hash; my $key = "test"; if (exists $hash{$key}) { # do something } else { # do something else }
You're question's not particularly clear, and that's a complete stab in the dark *grin* - could you post a little more about what it is you're trying to achieve?

-- Foxcub
#include www.liquidfusion.org.uk

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-18 23:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found