Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Hi JohnGG,

I tried running the script but this error kept popping up! Note that I modified it to take files:

my $FILENAME1 = "random.txt"; open(INFILE1, $FILENAME1); my @tests = map [ split ], <INFILE1>; my $FILENAME2 = "my_column_file.txt"; open(INFILE2, $FILENAME2); my @results; while ( <INFILE2> ) { my @cols = split; foreach my $idx ( 0 .. $#tests ) { foreach my $subidx ( 0 .. $#{ $tests[ $idx ] } ) { my @posns = split m{}, $tests[ $idx ]-[ $subidx ]; $results[ $idx ]-[ $subidx ] ++ if scalar @posns == grep { q{r} eq $cols[ $_ ] } @posn +s; } } } say qq{@$_} for @results;

the error was:

Can't modify anonymous list ([]) in postincrement (++) at gg.pl line 2 +0, near "] ++" syntax error at gg.pl line 26, near "say qq{@$_}" Execution of Jgg.pl aborted due to compilation errors.

Line 26 is this one: $results $idx - $subidx ++. Also I notice an error/flag in the last line. Should i change the say to print?


In reply to Re^4: Count similar characters in a row by $new_guy
in thread Count similar characters in a row by $new_guy

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (6)
    As of 2014-07-12 22:44 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      When choosing user names for websites, I prefer to use:








      Results (241 votes), past polls