in reply to How to escape single quote(s) without the use of quotemeta

Is this what you are after?

use strict; use warnings; use Test::More tests => 1; my $have = "This sting it's bothering to escape ' single characters"; my $want = "This sting it\\'s bothering to escape \\' single character +s"; $have =~ s/'/\\'/g; is $have, $want;

Replies are listed 'Best First'.
Re^2: How to escape single quote(s) without the use of quotemeta
by thanos1983 (Parson) on Apr 05, 2019 at 14:49 UTC

    Hello hippo,

    Thanks it works. I thought also about escaping the back slash character and I have tried it but it did not worked for me. I guess s and g is what I was looking for.

    Thanks again for your time and effort.

    BR / Thanos

    Seeking for Perl wisdom...on the process of learning...not there...yet!