in reply to most efficient buffer sort
I'm not sure what you are trying to achieve, but if the following (leaving out the HTML stuff for the moment) does what you want let us know:
use strict; use warnings; my @lines; while (<DATA>) { my ($first, $sort, $second, $tail) = m/^(\w+)\s+(\d+)\s+(\w+)(.*)$/; die "Unable to match any lines:$!\n" if ! defined $tail; push @lines, [$sort, $first, $second, $tail]; } print join "\n", map {"$_->[1] $_->[0] $_->[2]$_->[3]"} sort {$a->[0] +<=> $b->[0]} @lines; __DATA__ a 0 f g j k b 4 y h t e e e c 1 n s v c x d 3 f f f
Prints:
a 0 f g j k c 1 n s v c x d 3 f f f b 4 y h t e e e
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |