Wednesday, August 14, 2013

What is the best way to traverse through hashes in Perl?

%FM = (
'91.1 '=> 'Radio City',
'92.7' => 'Big FM',
'93.5' => 'Red FM',
'94.3' => 'Radio One',
'98.3' => 'Radio Mirchi',
'104.0' => 'Fever',
'104.8' => 'Oye FM',
'107.1' => 'FM Rainbow',
'100.7' => 'FM Gold',
);

while (my ($Frequency, $Station) = each %FM) {
    print "$Frequency =  $Station\n";   
}

No comments :