Your sort sub is really wierd which makes me suspect that I am
misunderstanding your intentions but if youu want to only sort by the keys
column then the following should work

---code---
%map = { ...blahblahblah... };
for (sort {$a <=> $b} keys %map ) { printf ...blahblahblah... }
---code---

that should do the trick
On Thu, Aug 23, 2001 at 04:32:02PM -0300, Mellotto shaped the electrons to read:
> 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]
> 

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

Reply via email to