in reply to sort based on column values

Create an array where each element represents a row as an array of fields.

my @lines; while (<>) { chomp; push @lines, [ $_, split /\t/ ]; } @lines = sort { $a->[9] <=> $b->[9] } @lines; for (@lines) { print "$_->[0]\n"; }

It can be written more tersely as:

print map "$_->[0]\n", sort { $a->[9] <=> $b->[9] } map [ $_, split /\t/ ], map { chomp( my $s = $_; ); $s } <>;