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
@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  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.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link or
or How to display code and escape characters
are good places to start.