in reply to text sorting question, kinda

You can also get away with one array but only storing the non-matching lines, and printing out (or processing) the matching ones immediately. (slight rework of Plaid's code...)

my @other_lines; while(<FILE>) { # whatever regex to strip out lines (/blahblah$/) ? print OUTFILE : push @other_lines, $_; } print OUTFILE @other_lines;
This way, not only do you only use one array, but you don't even store All of the lines in it- it only stores the nonmatching lines.

Alan