Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Below is my code;-
The problem is it sort the number but not the string$strings{"E1,E2"} = $afinity12c; $strings{"E1,E3"} = $afinity13c; $strings{"E1,E4"} = $afinity14c; $strings{"E1,E5"} = $afinity15c; $strings{"E1,E6"} = $afinity16c; $strings{"E1,E7"} = $afinity17c; $strings{"E1,E8"} = $afinity18c; $strings{"E1,E9"} = $afinity19c; $strings{"E1,E10"} = $afinity110c; print map{ "$_ = $strings{$_}\n <p>" } sort{ $strings{$b} <=> $strings{$a} } keys %strings;
the output will be
E1,E2 = 1
E1,E5 = 0.7
E1,E3 = 0.7(should E1,E5 is before E1,E5)
E1,E7 = 0.7
...................TQ
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: sorting not sort
by davido (Cardinal) on Aug 29, 2005 at 07:45 UTC | |
Re: sorting not sort
by Roger (Parson) on Aug 29, 2005 at 08:42 UTC | |
Re: sorting not sort
by gargle (Chaplain) on Aug 29, 2005 at 08:19 UTC | |
by gargle (Chaplain) on Aug 29, 2005 at 08:42 UTC | |
Re: sorting not sort
by Anonymous Monk on Aug 29, 2005 at 07:36 UTC | |
Re: sorting not sort
by ysth (Canon) on Aug 29, 2005 at 23:23 UTC |
Back to
Seekers of Perl Wisdom