in reply to misbehaving program

for deleting .out and .dssp files, use unlink:
unlink $dsspfile; unlink $outfile;
As for creating OUTPUT file, it seems like you try to append to the file instead of writing to it. If you are creating the file and writing to it, you can try this:
open(OUTFILE, "> $residuecombofile") || die "ERROR: Unable to open $re +siduecomdofile for writing: $!\n" print OUTFILE "$phiangle\t$psiangle $pdbcode\n"; ... close OUTFILE;
Hope this helps...