in reply to Improving script's speed and performance...

How slow is too slow ? You are running through the inner loop 300+ million times, so it might take a while.

Have you tried Profiling your code.? It will tell you where most of the time is being spent, and then you know where the improvements are needed.

A couple of things that might help a bit -

* You could use length to count the characters in a string, which should be quicker the creating an array each time.

* You don't care about the indexes of your arrays so you could write your loops like this :-

for my $lhs (@array1) { ... for my $rhs (@array2) { lcssw($lhs, $rhs); ... } }