my $repl = '$1'; my $str = "a,A,c,d"; s/([a-z]),/$repl/eeg; # Note the double 'e' modifier say $str; __END__ aA,cd