I am a beginner for perl. I am writting a program to check if the data in the same column have the same letter,if it finds different letter,then print column number and done for this column and go to compare another column. The table have hundards of columns and rows. so I use two loops, it does not work!
#!/usr/bin/perl -w use strict; open(FH, "table") or die "Can't open file to read!:$! \n"; my $i=2; for (my $i=2; $i<=682; $i++){ while (<FH>){ chomp; my @matrix=split; my $seed=$matrix[$i];#each time I compare one column; next until ($seed=~/[ACGTN-]/ && (!($seed =~ /\$seed/))) { print "P",$i," "; }#Line 23 } $i=$i+1; }until($i>682);#Line 29 close FH; exit;

syntax error at ./dwarfcmp line 23, near "}"
syntax error at ./dwarfcmp line 29, near "}"
Execution of aborted due to compilation errors.
I try more, it did not stop after it find the different letter,and it never can get out of the while loop too!
Please help! Thanks advance.

Edit kudra, 2002-05-30 Fixed code tags--wrap entire code in one set of code tags, not each line in code tags!


In reply to How to control the loop 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.