use strict; use warnings; open my $F1, '| sort >t' or die; while () { print $F1 $_; } __DATA__ the quick red fox jumped over the lazy brown dog #### $ perl foo.pl $ cat t brown dog fox jumped lazy over quick red the the