You would use a next statement if your code is in a while or for loop. Is this the case?
On a minor note, you test $best_X <= 100 twice. You could refactor it to only test it once. If the condition changes you only have one thing to change (same applies to $best_Y).
In your $best_X tests you test $block1 and $block2 and in the $best_Y tests you test $block1 twice. Is that what you intended? This may be an over enthusiastic search for symetry on my part. :-)
There appears to be an unmatched closing brace.
But, but, but... The main thing is to test it rigourously. With all possible values for every variable and in all possible combinations. And then some. Then you'll know if you are heading in the right direction.
I've taken the liberty of tweaking the format a bit.
#! /usr/bin/perl use strict; use warnings; my ( $best_X, $best_Y, $block1, $block2, $counter, $tq, $pp, $pp2, $pz, $pz2, $position1, $position2, $resH, $nTE2 ); #keep counts of matches to check for unique match $counter++ if ( $best_X <= 110 && $block1 <= 110 || $best_Y <= 110 && $block2 <= 110 ); if ($counter == 1){ $tq = "unique_match"; } elsif ($best_X <= 100){ if ($block1 <= 100){ $pp = "best_match+TE"; } elsif ($block2 <= 50 && $position2 < 5){ $pp2 = "best_match-TE"; } } else{ next; # are we in a loop? } if ($best_Y <= 100){ if ($block1 >= 70){ $pz = "best_match+TE"; } elsif ($block1 <= 50 && $position1 >= 50){ # block2? $pz2 = "best_match-TE"; } } else{ next; } #} perl complains about this one $resH = $tq; if ($pp eq $pz){ $resH = "best_match+TE"; } elsif ($nTE2 eq $pp2 || $nTE2 eq $pz2){ $resH = "best_match -TE" }
In reply to Re: I need help with a bunch of "if/elsif statements (comparisons)"
by wfsp
in thread I need help with a bunch of "if/elsif statements (comparisons)"
by erons
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |