Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Perl: Check if a key exists in the hash

Perl: Check if a key exists in the hash
{filelink=14707}

#!/usr/bin/perl
# create an Hash
%myHash = ( "january"  => 31,
          	  "February"  => 28,
              "March" => 31,
              "April"  => 30,
              "May"  => undef );
if(exists($myHash{'June'}))
{
  print "This entry already exists";
}else
{
 # Add non existent entry
 $myHash{'June'}="30"
}
 # print Hash items
foreach my $item (keys %myHash)
{
    print "$item=>$myHash{$item}n";
}

Users who found this page were searching for:

  • comma operator in java
  • if tuple already exists cplex programming
  • python print round
  • how to convert string to double in jtable java
  • accessing password protected folder from java
  • how to convert data string in jtable as a double
  • How to compare strings in python
  • reading email with python
  • how to add a menu to jframe?
  • perl check ahash key exists

No comments yet.

Leave a Comment