sub score2 { my ($word1, $word2) = @_; return $words_equal if ($word1 eq $word2); my @chars1 = split(//, $word1); my $count = 0; foreach $a (@chars1) { if ($word2 =~ /$a/) { $count++; last; } } return $count; }