#!c:\perl\bin\perl.exe -w use strict; use warnings; use diagnostics; my @a; $a[1]{total} = 10; $a[2]{total} = 50; $a[3]{total} = 40; $a[4]{total} = 30; $a[5]{total} = 20; my @b = map { $_->[1] } sort { $b <=> $a } map { [ $a[ $_ ]->{total}, $_ ] } 0..$#a; for my $x (0..$#b) { print "$b[$x] = $a[$b[$x]]{total}\n"; } #### 5 = 20 4 = 30 3 = 40 2 = 50 1 = 10 Use of uninitialized value in concatenation (.) or ... 0 = #### 2 = 50 3 = 40 4 = 30 5 = 20 1 = 10