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