in reply to Case-sensitive substitution with case-insensitive matches

Here is Another Way:

my $foo = "AbC"; my $bar = "Ducks"; $string = "ABCDEFGHIJabc"; $string =~ s/($foo)/ for (my $i=0, my $j=length $1, my $k=length $bar; $A=substr($foo,$i,1) and $B=substr($bar,$i,1); $i++) { if ( $A ge 'A' and $A le 'Z') { substr($bar,$i,1) = uc($B); } }$bar /giex;