sub score { # Same as above, until: my $cnt1 = @{[$x =~ /[$y]/g]}; my $cnt2 = @{[$y =~ /[$x]/g]}; $cnt1 < $cnt2 ? $cnt1 : $cnt2; }