in reply to Sorting in Perl
If you're on linux/unix you could use the sort utility which will do that without you writing any code at all.