note
tlm
<p>As others have pointed out you are not running under <tt>use strict</tt> and <tt>use warnings</tt>, and you are not checking the return status of your <tt>system</tt> calls. For the latter you should at least have something like
<code>
system("dsspcmbi $pdbstructure $dsspfile") and die "System called failed.";
</code>
to alert you that something went awry, and where. (Note that [doc://system|<b><tt>system</tt></b>] is the unusual Perl function that returns a true value upon failure, hence the <tt>and</tt> clause to check for failure.)</p>
<p>Next, the line
<code>
$residuecombofile = "$combodir$residue1$residue2$residue3$out";
</code>
is executed redundantly at a couple of places throughout the program (as far as I can tell, the RHS always evaluates to the same value); moreover, <tt>$residue1, $residue2,</tt> and <tt>$residue3</tt> are undefined. (BTW, on the naming of variables, you may want to read this [id://46769|node].) In your post you refer to "<tt>OUTFILE</tt>'s" but it is clear that this program will generate at most one <tt>OUTFILE</tt>, whose name is the constant value of <tt>$residuecombofile</tt>.</p>
<p>You open a file handle <tt>PDB</tt> with this line
<code>
if(open(PDB,"$pdbstructure"))
</code>
but you don't do anything with the handle. If all you want to do is check for the existence of this file, use
<code>
if ( -e $pdbstructure )
</code>
or better yet
<code>
if ( -r $pdbstructure )
</code>
(See [doc://-X|file test operators]). Furthermore, if the <tt>open</tt> cited above fails <em>once</em>, then it sets <tt>$flag</tt>, which <em>would stay set</em>, since it is never reset back to 0 anywhere (in fact, this variable is never properly initialized outside of the loop); this means that, after one failure of the <tt>open</tt>, the <em>then</em> clause of the <tt>if</tt> statement beginning with
<code>
if($flag == 0)
</code>
would never again be executed, even if subsequent calls calls to <tt>open(PDB,"$pdbstructure")</tt> structure succeed. (BTW, the idiomatic way to make the test above is <tt>unless ( $flag )</tt>.) Do you ever see the message
<code>
No structure file. Moving to next structure in list
</code>
?
</p>
<div class="pmsig"><div class="pmsig-439528">
<p><small>the lowliest monk</small></p>
</div></div>
449545
449545