Looping Over A Hash : Hash Loop « Hash « Perl






Looping Over A Hash

   

#!/usr/bin/perl
use warnings;
use strict;
my %where=(
    G => "g",
    L => "l",
    I => "i",
    S => "s"
);
for (keys %where) {
print "$_ lives in $where{$_}\n";
}

   
    
    
  








Related examples in the same category

1.Iterate hash
2.Loop through an associative array
3.Loop through an associative array While loop
4.Using foreach loops with hashes
5.While loop and hash key value pair
6.Using while and each function to output value in a hash