in reply to Sorting a file and printing it back onto itself

I think you can minimize multi-opening files by opening once:

open FH, "+>>$virttmp" or die "Cannot open file: $!\n"; seek FH, 0, 0; my @v = <FH>; seek FH, 0, 0; truncate $virttmp, 0; print FH sort @v; close FH;

He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

Chady | http://chady.net/