http://www.perlmonks.org?node_id=11135041


in reply to Extra backlash getting added to string

Erm, no.

$ perl -E 'my $file="Bob_Smith"; $file =~ s/_/\\_/g; say $file' Bob\_Smith

You're doing something wrong; this isn't the actual code you're using, or you're not showing us something (for instance if you're using Data::Dumper to print things out it's going to show you the string as you'd give to perl which of course would need the backslash doubled inside a "" string).

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^2: Extra backlash getting added to string
by newperldeveloper (Sexton) on Jul 15, 2021 at 18:00 UTC
    I was using data dumper. thanks everyone.