my @quotes = qw/ ` ' /; my $i = 0; $string =~ s/"/$quotes[$i++ % 2]/g;