This is essentially a variant of the Schwartz Transform, using a hash in place of an array to keep the sort field(s).my %data; ( $data{ $_}) = /^\d+\s+(\d+)/ while <DATA>; print for sort { $data{ $a} cmp $data{ $b} } keys %data;
Anno
In reply to Re^3: Sorting a text file
by Anno
in thread Sorting a text file
by rsriram
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |