Hi
I've tried to sort hash values. The following file shows my problem:
----------------------------------------------------
#!/opt/perl5/bin/perl
%map = (
    1  => 1,
    2  => 10,
    3  => 200,
    4  => 2,
    5  => 5,
    6  => 150,
    7  => 45,
    9  => 12,
    8  => 30,
    10 => 13,
);
for  (sort {$map{$a} <=> $map{$b} || sort $b } keys %map) {
        printf("%d;%d\n", $_, $map{$_});
}
----------------------------------------------------
The output for this script:
1;1
4;2
5;5
2;10
9;12
10;13
8;30
7;45
6;150
3;200

I need to sort numerically by first column. I've written it
in many ways, but it still sorting by second column.

Could you help me solve this problem?

Cheers
[ ]'s
Mellotto.




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to