in reply to Simple Hash Question
#!/usr/bin/perl use strict; use warnings; my $count = 1; my @array = ('A','B','C'); my %hash = (); for my $i (@array) { # set key AND initialize by $count as value of key. $hash{$i} = $count; $count++; } for my $key ( sort {$hash{$a} <=> $hash{$b} } keys %hash ) { print " MIRACLE_HAPPENS is equal to $key.<br>\n"; }
|
|---|