in reply to Re^2: More efficient way for this pattern match?
in thread More efficient way for this pattern match?

Good catch. It's a bug. The line:

next if substr($str1, $start, $matchLen) =~ /^-+$/;

should be more like (untested):

next if ! matchLen || substr($str1, $start, $matchLen) !~ /[^-]/;
Perl is the programming world's equivalent of English