Re: How to find if a key exist in hash?

2004-09-29 Thread John W. Krahn
[EMAIL PROTECTED] wrote: %a = ( "a" => 1, "b" => 2, "c" => 3 ); $searchKey = "a"; print "Found $searchKey" if defined($a{$searchKey}); Try that with this hash: my %a = ( a => undef, b => undef, c => undef, ); defined() does not tell you if a key exists. perldoc -f exists Jo

Re: How to find if a key exist in hash?

2004-09-29 Thread max4o
%a = ( "a" => 1, "b" => 2, "c" => 3 ); $searchKey = "a"; print "Found $searchKey" if defined($a{$searchKey}); - This mail is from: <[EMAIL PROTECTED]> - -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additiona

RE: How to find if a key exist in hash?

2004-09-29 Thread NYIMI Jose \(BMB\)
> -Original Message- > From: Edward Wijaya [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 29, 2004 12:17 PM > To: [EMAIL PROTECTED] > Subject: How to find if a key exist in hash? > > > Hi, > > I have the following code, > and I know it is HORRIBLE. > > I wonder if I can do it

Re: How to find if a key exist in hash?

2004-09-29 Thread Gunnar Hjalmarsson
Edward Wijaya wrote: Subject: How to find if a key exist in hash? There is a builtin Perl function for the purpose. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]