On Fri, Jul 20, 2001 at 10:08:13PM +0200, allan wrote:

> i know theres more than one way to do it, but i would like a cleaner way.
> im trying to globally replace singlesqoutes with doubleqoutes and vice
> versa and the script below does seem to work but its rather an akward
> way to do it. is there a solution to do this without using those kinds
> of placeholders?

> $str =~ s/'/some_temp_for_singles/g;
> $str =~ s/\"/some_temp_for_doubles/g;
> $str =~ s/some_temp_for_singles/"/g;
> $str =~ s/some_temp_for_doubles/'/g;
> print "OK: ", $str;

Use the translation operator, which does character-to-character
translations:

$str =~ tr/'"/"'/;

Ronald

Reply via email to