Ok, I've deciphered what the initial part of the script does, and I've added some stuff to it which I will post separately once I understand this last bit of the script. I just need some help with the last bit before I try and put everything I've learned together. I've put some comments in the code below about bits I'm confused about. This is the last bit of the script which does the match.
@titlewords = @new; #switch the @new array back to the name @titlewo +rds now that the exceptions are in place my $desired = 5; # Desired matching number of words my $matched = 0; # Why is this set to 0? How does it change dur +ing the comparison foreach my $csv2 (keys %csv2hash) { my $count = 0; #Again why is this set to 0 at this point? I can + see that it's used later and compared to $desired, but how does it i +ncrease in size past 0 during the operation? my $value = $csv2hash{$csv2}; # How does this represent the value +? There doesn't seem to be any code which counts the words here? foreach my $word (@titlewords) { my @matches = ( $value=~/\b$word\b/ig ); my $numIncsv2 = scalar(@matches); @matches = ( $title=~/\b$word\b/ig ); my $numIncsv1 = scalar(@matches); ++$count if $value =~ /\b$word\b/i; if ($count >= $desired || ($numIncsv1 >= $desired && $numI +ncsv2 >= $desired)) { $count = $desired+1; last; } } if ($count >= $desired) { print "$csv2\n"; ++$matched; } } print "$_\n\n" if $matched; } + close CSV1;

In reply to Re^14: Addional "year" matching functionality in word matching script by bms9nmh
in thread Addional "year" matching functionality in word matching script by bms9nmh

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.