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


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