Hi monkers, i humbly seek your advice for a syntax error that im not able to spot in my code for hours.
#!/usr/bin/perl use 5.010; use strict; use warnings; open BLOCKS,'blocks.txt'; open START,'start.txt'; open STOP,'stop.txt'; open NP,'np.txt'; open TRIPLET,'>triplet.txt'; my @blocks=<BLOCKS>; my @start=<START>; my @stop=<STOP>; my @np=<NP>; chomp @blocks; chomp @start; chomp @stop; chomp @np; my $i; my $index=0; my $first; my $second; my $third; my $a=0; my $b=1; my $c=3; my $flag; for($i=0;$i<(scalar(@blocks));$i++) { if($blocks[$index]=~m/^\d.+/) { if ($blocks[$a]=~m/^\d.+/ and $blocks[$b]=~m/^\d.+/ and $block +s[$c]=~m/^\d.+/) { if($np[$a] eq $np[$b] || $np[$a] eq $np[$b] || $np[$b] eq +$np[$c]) { if ($np[$a] eq $np[$b]) { $flag=$np[$a]; print TRIPLET "$start[$a]\t$stop[$a]\t$np[$a]\t$fl +ag\n"; print TRIPLET "$start[$b]\t$stop[$b]\t$np[$b]\t$fl +ag\n"; print TRIPLET "$start[$c]\t$stop[$c]\t$np[$c]\t$fl +ag\n"; } else { $flag=$np[$c]; print TRIPLET "$start[$a]\t$stop[$a]\t$np[$a]\t$fl +ag\n"; print TRIPLET "$start[$b]\t$stop[$b]\t$np[$b]\t$fl +ag\n"; print TRIPLET "$start[$c]\t$stop[$c]\t$np[$c]\t$fl +ag\n"; } } else { #ambigious data print TRIPLET "$start[$a]\t$stop[$a]\t$np[$a]\t$np[$a] +\n"; print TRIPLET "$start[$b]\t$stop[$b]\t$np[$b]\t$np[$b] +\n"; print TRIPLET "$start[$c]\t$stop[$c]\t$np[$c]\t$np[$c] +\n"; } elsif ($blocks[$a]=~m/^\d.+/ && $blocks[$b]=~m/^\d.+/) { if($np[$a] eq $flag || $np[$a] eq $flag) { print TRIPLET "$start[$a]\t$stop[$a]\t$np[$a]\t$flag\n +"; print TRIPLET "$start[$b]\t$stop[$b]\t$np[$b]\t$flag\n +"; } else { print TRIPLET "$start[$a]\t$stop[$a]\t$np[$a]\t$np[$a] +\n"; print TRIPLET "$start[$b]\t$stop[$b]\t$np[$b]\t$np[$b] +\n"; } } else { print TRIPLET "$start[$a]\t$stop[$a]\t$np[$a]\t$np[$a]\n"; } } else { print TRIPLET "$blocks[$index]\n"; } $index++; $a=+2; $b=+2; $c=+2; } close BLOCKS; close START; close STOP; close NP; close TRIPLET; exit;

the error that i get is syntax error at line 60 near "elsif" syntax error at line 81 near "else" syntax error at line 90 near "}" missing right curly or square brackets at the end


In reply to unknown syntax error by Anonymous Monk

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.