Ok, I'm still not sure what exactly should happen but it seems you first want to classify both ids in the same way. This is a job for a subroutine, so that you don't have to do that twice:

sub award_score { #awards one of three scores to a tupel of # best result,block and position. The scores are # ... my ($best,$block,$position)= @_; my $result="nothing"; if ($best<100 and $block<100) { ... $result='best_match-TE' } elsif { ... $result= ... } return $result; }

Now that you have a well defined and (hopefully) well documented subroutine to do the preliminary work on each individual score, you can add the main code:

my $result_x= award_score($best_x,$block1,$position1); my $result_y= award_score($best_y,$block2,$position2); if ($result_x eq $result_y) { ... }

This is only a rough draft that you have to adapt, it is just to show you the principle. Somehow or other a similar method should work for you. If you need more parameters into the subroutine, just do that. If you need to return more than one result, likewise no problem. If your main routine looks so simple that someone else could understand it immediately you have won

PS: variable names like $nTE2 are cryptic and not very helpful if you or someone else has to understand the code one year later


In reply to Re^3: I need help with a bunch of "if/elsif statements (comparisons)" by jethro
in thread I need help with a bunch of "if/elsif statements (comparisons)" by erons

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.