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> my $action;<br><br> if ( $x ne "NULL" )<br> {<br> # $x and x are always the same
<br> $HASH{$id}{'x'} = $x;<br> $action ++;
<br> }<br><br> if ( $y ne "NULL" )<br> {<br> $HASH{$id}{'y'} = $y;<br> $action++;<br> }<br><br> #### snipping about 28 other ifs ####<br><br> if ($action)<br> {<br> # do something
<br> }<br><br>}<br><br>Id like to shorten the cluster of ifs with something like<br><br>for my $id(@transactions)<br>
{<br>
<br>
my $action;<br> for my $ref (@listofrefs)<br> {<br> $HASH{$id}{'ref'} = $ref<br> if ( $ref ne "NULL" )<br> $action++;<br> }<br><br> if ( $action )<br> {<br> # do something...
<br> }<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>"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's going to rise tomorrow. "
<br> -- Robert M Pirsig