http://qs321.pair.com?node_id=25841


in reply to text sorting question, kinda

The first way that comes to mind offhand would be to do something like
my @top_lines; my @other_lines; while(<FILE>) { # whatever regex to strip out lines (/blahblah$/) ? push @top_lines, $_ : push @other_lines, $_; } print OUTFILE @top_lines; print OUTFILE @other_lines;
This would work well provided that the file doesn't get too big, as the entire thing is going to have to be kept in memory. But, if it's about 200k as you say, that should work fine.