Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: unknown syntax error
by Loops (Curate) on Jul 05, 2013 at 05:59 UTC | |
|
Re: unknown syntax error
by CountZero (Bishop) on Jul 05, 2013 at 06:17 UTC | |
|
Re: unknown syntax error
by zork42 (Monk) on Jul 05, 2013 at 09:20 UTC | |
by sahil2588 (Novice) on Jul 05, 2013 at 09:30 UTC | |
|
Re: unknown syntax error
by Anonymous Monk on Jul 05, 2013 at 05:58 UTC | |
|
Re: unknown syntax error
by sahil2588 (Novice) on Jul 05, 2013 at 07:52 UTC |