Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Extra backlash getting added to string

by Fletch (Chancellor)
on Jul 15, 2021 at 17:14 UTC ( #11135041=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11135041]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2021-09-17 17:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?