in reply to Sorting files you Have read

First suggestion: use your system's sort routine. While I think the *ix sort is better than the Windows sort, both are reliable, and quite fast.

As for sorting a list in Perl:

use strict; # a good idea use warnings; # and another my $input = 'myinput.txt'; open(my $in, "<", $input) or die "Could not open $input because $!\n"; @unsorted = <$in>; chomp(@unsorted); # get rid of end-of-record markers close($in); @sorted = sort @unsorted;

will sort the @unsorted array, based on the entire string, with the output going to @sort. Note that this requires a copy of the entire file be in memory, which may be a Bad Idea. There are several tutorials, for example, here and here. And of, course, here.


At that time [1909] the chief engineer was almost always the chief test pilot as well. That had the fortunate result of eliminating poor engineering early in aviation.

—Igor Sikorsky, reported in AOPA Pilot magazine February 2003.