Perhaps a stupid one...<br><br>I have a block of about 30 if statements such as<br><br>my %HASH;<br><br>for my $id(@transactions)<br>{<br><br>&nbsp;&nbsp;&nbsp; my $action;<br><br>&nbsp;&nbsp;&nbsp; if ( $x ne &quot;NULL&quot; )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # $x and x are always the same
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $HASH{$id}{&#39;x&#39;} = $x;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $action ++;
<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp; if ( $y ne &quot;NULL&quot; )<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $HASH{$id}{&#39;y&#39;} = $y;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $action++;<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp; #### snipping about 28 other ifs ####<br><br>&nbsp;&nbsp; if ($action)<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # do something
<br>&nbsp;&nbsp; }<br><br>}<br><br>Id like to shorten the cluster of ifs with something like<br><br>for my $id(@transactions)<br>
{<br>
<br>
&nbsp;&nbsp;&nbsp; my $action;<br>&nbsp;&nbsp;&nbsp; for my $ref (@listofrefs)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $HASH{$id}{&#39;ref&#39;} = $ref<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( $ref ne &quot;NULL&quot; )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $action++;<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; if ( $action )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # do something...
<br>&nbsp;&nbsp;&nbsp; }<br>}<br clear="all"><br>I know ive done this or something like it before, I just cant find<br>the code...<br><br>Ted<br><br>-- <br>&quot;You are never dedicated to something you have complete confidence in. No one is fanatically shouting that the sun is going to rise tomorrow. They know it&#39;s going to rise tomorrow. &quot;
<br>&nbsp;&nbsp;-- Robert M Pirsig