UNIX style: perl -e 'push @file,$_ while<>;print sort {$a <=> $b} @file' test.txt Dos style: perl -e "push @file,$_ while<>;print sort {$a <=> $b} @file" test.txt Results: 1 b005824 134 b005376 402 astamen 972 achin00 181847 azeleke 1260896 abadeno Is this on the commad line? How would I incorporate this into my script? Thanks for the help.