Hi
Check the input itself is not containing the '\', because it is interpolated in double quotes.
use strict;
my $string = "this is my sting with \ and /slashes. put substing in qu
+otes";
my $substring = "with \ and /slashes";
print $string;
$string =~ s/\Q$substring\E/\"$substring\"/gi;
OUTPUT:
this is my sting with and /slashes. put substing in quotes
Instead use single quote in the input like,
use strict;
my $string = 'this is my sting with \ and /slashes. put substing in qu
+otes';
my $substring = 'with \ and /slashes';
print $string;
$string =~ s/\Q$substring\E/\"$substring\"/gi;
OUTPUT:
this is my sting with \ and /slashes. put substing in quotes
This will give the correct output
Punitha |