#!/usr/bin/perl
$scoreOfMods{'a'}=-0.1;
$scoreOfMods{'b'}=-0.3;
$scoreOfMods{'c'}= 10;
foreach $mod_full_name( sort { $scoreOfMods{$a} <=> $scoreOfMods{$b} } keys %scoreOfMods){
print "$mod_full_name==>$scoreOfMods{$mod_full_name}\n";
#b==>-0.3
#a==>-0.1
#c==>10
}
foreach $mod_full_name(reverse( sort { $scoreOfMods{$a} <=> $scoreOfMods{$b} } keys %scoreOfMods)){
print "$mod_full_name==>$scoreOfMods{$mod_full_name}\n";
#c==>10
#a==>-0.1
#b==>-0.3
}
foreach $mod_full_name( sort { $scoreOfMods{$b} <=> $scoreOfMods{$a} } keys %scoreOfMods){
print "$mod_full_name==>$scoreOfMods{$mod_full_name}\n";
#c==>10
#a==>-0.1
#b==>-0.3
}
No comments:
Post a Comment