c:\@Work\Perl>perl -wMstrict -le "my $c = q{asdfghjk}; print qq{ original: '$c'}; ;; my @regex = ( { lh => q{(gh)}, rh => q{__$1__}, }, { lh => q{(h_)}, rh => q{_h!$1!}, }, ); ;; for my $hr_s (@regex) { $c =~ s[ (?-x)$hr_s->{lh}]{ qq{qq{$hr_s->{rh}}} }xmsgee; print qq{intermediate: '$c'}; } ;; print qq{ final: '$c'}; " original: 'asdfghjk' intermediate: 'asdf__gh__jk' intermediate: 'asdf__g_h!h_!_jk' final: 'asdf__g_h!h_!_jk'