Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Unable To Replace Escape Sequences With 1-Char Equivalents

by etcshadow (Priest)
on Oct 20, 2004 at 02:32 UTC ( #400741=note: print w/replies, xml ) Need Help??


in reply to Unable To Replace Escape Sequences With 1-Char Equivalents

What you mean to be doing with your unescape routine is actualy:
sub unescape { my($s)=@_; $s =~ s/(\\[^\d])/"\"$1\""/gee; #"\t", "\n", etc. $s =~ s/(\\0\d+)/"\"$1\""/gee; #"\07", etc. return $s; }

That is: implicitly evoking an eval with a second /e modifier. Also, you could really do both regexes in one regex (and, fyi: [^\d] is also called, more simply, \D):

sub unescape { my($s)=@_; $s =~ s/\\(0\d+|\D)/"\"\\$1\""/gee; return $s; }
------------ :Wq Not an editor command: Wq

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (1)
As of 2019-09-22 08:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The room is dark, and your next move is ...












    Results (273 votes). Check out past polls.

    Notices?