Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: How to escape single quote(s) without the use of quotemeta (Data::Dumper)

by LanX (Cardinal)
on Apr 05, 2019 at 11:54 UTC ( #1232200=note: print w/replies, xml ) Need Help??


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

quotemeta is meant for regex metas which form a super-set of "string metas".

But what about the stringyfications from Data::Dumper (single quote) or Data::Dump (double quote)?

DB<62> use Data::Dumper qw/Dumper/ DB<63> $Data::Dumper::Terse = 1; DB<64> $x= Dumper q(It's\x\\) DB<65> print "<<<$x>>>" <<<'It\'s\\x\\' >>> DB<66> chomp $x DB<67> $x =~ s/^'(.*)'$/$1/ DB<68> print "<<<$x>>>" <<<It\'s\\x\\>>> DB<69>

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

edit

NB: If you wanna use $Data::Dumper::Terse think of localizing it or use the OO interface ...

  • Comment on Re: How to escape single quote(s) without the use of quotemeta (Data::Dumper)
  • Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2021-06-21 17:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (99 votes). Check out past polls.

    Notices?