Using values function to get all value in a hash : values « Hash « Perl






Using values function to get all value in a hash

   

#!/usr/bin/perl -w

use strict;

my %where = (
     A     => "AA",
     B     => "BB",
     C     => "CC",
     D     => "DD"
);

foreach (values %where) {
    print "someone lives in $_\n";
}

   
    
    
  








Related examples in the same category

1.The values function returns, in random order, an array consisting of all the values of a hash.