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:

  • how to underline the string in java
  • python hash entry exists
  • python convert string to number
  • perl check if key exist
  • perl check if exists key in hash
  • accessing password protected folder from java
  • How to compare strings in python
  • java font underline
  • perl check ahash key exists
  • comma operator in java

No comments yet.

Leave a Comment