in reply to How to insert a "/" within a string?

Something like $str =~ s{CO}{C/O}g maybe?

See also: perlintro, perlretut.

Replies are listed 'Best First'.
Re^2: How to insert a "/" within a string?
by bimleshsharma (Beadle) on Feb 21, 2012 at 11:06 UTC
    This will also work...
    my $string = 'ACOCOB'; $string =~ s/CO/C\/O/g; print "$string\n";
      Yes, but he intentionally avoided using "/" as a delimiter to avoid "leaning toothpick syndrome".