If you compare the code I gave you and your modified script you will notice that you have lost a couple of very important characters, changing the dereference operator(->) to the subtraction operator (-), i.e.

my @posns = split m{}, $tests[ $idx ]-[ $subidx ]; $results[ $idx ]-[ $subidx ] ++

should be

my @posns = split m{}, $tests[ $idx ]->[ $subidx ]; $results[ $idx ]->[ $subidx ] ++

With regard to say, it was introduced with Perl 5.10 so use print if your version is earlier. If on 5.10, you have to put use 5.010 in your script to access newer features like say. I've not used Perl 5.12 yet so I'm not sure whether the use is necessary there.

You have changed the script to use files but I would recommend that you use the three-argument form of open, employ lexical filehandles and also check for success, giving the o/s error on failure. Instead of

open(INFILE1, $FILENAME1);

do

open my $input1FH, q{<}, $FILENAME1 or die qq{open: < $FILENAME1: $!\n};

I hope this helps you moveforward.

Cheers,

JohnGG


In reply to Re^5: Count similar characters in a row by johngg
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!
  • 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.