in reply to FInding the longest match from an initial match between two files

Your for loop syntax is broken. It should be:

for my $Skmerkey (keys %Skmer) {

In several places you use () instead of {} for accessing hash values. The code should look like:

my $i = $Skmer{$Skmerkey};

I strongly recommend you use strictures (use strict; use warnings; - see The strictures, according to Seuss). You initialize the array @array2 but access $arrayS2[...] in several places. Strictures would have found that for you immediately.

Your first while loop references <IN>, but nothing opens IN as a file handle.

\chomp($line) is incorrect. Remove the \.

Premature optimization is the root of all job security

Replies are listed 'Best First'.
Re^2: FInding the longest match from an initial match between two files
by Allie_grater (Initiate) on Nov 08, 2016 at 22:21 UTC
    After fixing all the issues with ()/{}, the error is now with an uninitialized value in string eq at line 73 "$m++;" but I am thinking that perhaps I need to expand the if loop that contains the arrays to include $l and $m. As for the <IN>, doesn't reading into $query allow me to access the string outside of the first while loop?

      Your uninitialized value is most likely due to trying to access an element beyond the end of one of the two arrays. Consider what happens when the content of the two arrays is identical.

      I haven't looked at the logic of your code in any detail, but my impression is that you are not taking any advantage of the string processing power that Perl provides. In particular splitting strings up into arrays of characters smells really bad.

      Premature optimization is the root of all job security