Is that not just a very longhand way of saying:
perl -e 'print sort <>' < file > file.sorted
Anyway, both don't sort according to the current locale while the command "sort" does. See perllocale:
USING LOCALES The use locale pragma
By default, Perl ignores the current locale. The "use locale" pragma tells Perl to use the current locale for some operations:
The comparison operators ("lt", "le", "cmp", "ge", and "gt") and the POSIX string collation functions strcoll() and strxfrm() use "LC_COLLATE". sort() is also affected if used without an explicit comparison function, because it uses "cmp" by default.
Never knew that. I guess locales don't apply too much to people who work in English all of the time? Anyway, is this the fix?: perl -e 'use locale; print sort <>' < file > file.sorted Makes no difference on my machine with my test data of course. -- Australian Linux Technical Conference 2003: http://www.linux.conf.au/ Explain to your boss the benefits of you going...