Re: How to rearrange an array by a hash

2004-02-16 Thread Jan Eden
John W. Krahn wrote: >Shiping Wang wrote: >> >> Hi, > >Hello, > >> How can I rearrange an array in a specific order based on the order of a >> hash? Something like this: >> >> my @a = qw(Mary John Dan); >> print join "\t", @a, "\n"; >> >> my %b = ( John => 0, >> Dan => 1, >> Mary => 2); >> >>

Re: How to rearrange an array by a hash

2004-02-16 Thread John W. Krahn
Shiping Wang wrote: > > Hi, Hello, > How can I rearrange an array in a specific order based on the order of a > hash? Something like this: > > my @a = qw(Mary John Dan); > print join "\t", @a, "\n"; > > my %b = ( John => 0, > Dan => 1, > Mary => 2); > > print "$_ => $b{$_}\n" for (keys %b); >