in reply to Re: hash ordered by an array
in thread hash ordered by an array
but to do it in a particular order you would somehow have to index those keys. top of the head solution;sort keys %hash;
in this way you are doing, in a particular order something with your %hash values. i suppose this isn't exactly what you had in mind but...%hash = ('dog' => 1, 'big' => 5, 'jak' => 4, 'mack' => 19); @array = qw(dog mack jak big); foreach $val (@array){ print "$hash{$val}\n"; }
|
|---|