in reply to Is this code logical?

If you're using Perl 5.005_03 or higher, this is how I'd write your code:
open my $results, '<', $outputfile or die "Cannot open '$outputfile' for reading: $!\n'; open my $cleaned, '>', $new_outputfile or die "Cannot open '$new_outputfile' for writing: $!\n"; { my %seen; local $_; while ( <$results> ) { chomp; next if $seen{ $_ }++; print $cleaned $_, "\n"; } } # Always close in the reverse order of opening. close $cleaned; close $results; unlink $results or die "Cannot unlink '$outputfile': $!\n"; File::Copy::move( $new_outputfile, $outputfile ) or die "Cannot rename '$new_outputfile' to '$outputfile': $!\n";
The changes:

My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.