for my $i (0 .. $#array) { substr($string, $i, 1) = lc substr($string, $i, 1) if $array[$i] eq q(); }