Does this do the trick?

#!/usr/bin/perl -w
use strict;
my $string=q#Strip the \'slashes\' from the \"string\" if\and\only\if
they're followed by a ' or ".#;
print "Before: $string\n";
$string=~s#\\(['"])#$1#g; # match a \ followed by either a ' or ", and
replace with just the ' or "
print "After: $string\n";

Output looks like this:
Before: Strip the \'slashes\' from the \"string\" if\and\only\if they're
followed by a ' or ".
After: Strip the 'slashes' from the "string" if\and\only\if they're
followed by a ' or ".

Hope that helps.
>From one beginner to another (i.e. someone else is about to point out a
better way),
    Pete


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to