in reply to Re^2: Sorting a text file
in thread Sorting a text file

You could turn GrandFather's approach around and swap keys and values in the hash:
my %data; ( $data{ $_}) = /^\d+\s+(\d+)/ while <DATA>; print for sort { $data{ $a} cmp $data{ $b} } keys %data;
This is essentially a variant of the Schwartz Transform, using a hash in place of an array to keep the sort field(s).

Anno