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

Perl: reverse Hash

#!/usr/local/bin/perl
my% myHash = ("Germany" => "Berlin"
     "England" => "London"
     "France" => 'Paris');
foreach $contry (sort keys %myHash)
{

Perl: How to add item to hash

# create an Hash
( "january"  => 31,
          	  "February"  => 28,
              "March" => 31,
              "April"  => 30,
              "May"

Perl: Check if a key exists in the hash

#!/usr/bin/perl
# create an Hash
%myHash = ( "january"  => 31,
          	  "February"  => 28,
              "March" => 31,
              "April"  =>

Perl: How to sort hash by key

#!/usr/local/bin/perl
my% myHash = ("Germany" => "Berlin"
     "England" => "London"
     "France" => 'Paris');
foreach $entry (sort keys %myHash)

Perl: How to sort hash by value

#!/usr/bin/perl -w
my% myCities = ("Germany" => "Berlin"
     "England" => "London"
     "France" => 'Paris');
 # sort Hash values
foreach $elem (sor

Perl: How to get keys from Hash

#!/usr/bin/perl -w
# create an Hash
%myHash = ( "january"  => 31,
          	  "February"  => 28,
              "March" => 31,
              "April"

Perl: How to delete an entry in hash

#!/usr/bin/perl -w
use strict;
# create an Hash
%myHash = ( "january"  => 31,
          	  "February"  => 28,
              "March" => 31,

Perl: sort hash by length of the values

#!/usr/bin/perl -w
my %myCities = ("January" => 31,
           "February" => 28,
               "Mars" => 31,
               "April" => 30,
         

Perl: How to use Hash

# create an Hash
%myHash = ( "january"  => 31,
          	  "February"  => 28,
              "March" => 31,
              "April"  => 30,