Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: hex in regexp

by Anonymous Monk
on May 22, 2012 at 03:29 UTC ( #971713=note: print w/replies, xml ) Need Help??

in reply to hex in regexp

Like this

use CGI; my $freeStuff = CGI->escape( $stuff );

or this

use JSON; my $freeStuff = JSON->new->ascii(1)->pretty(1)->encode([ $stuff ]);

Replies are listed 'Best First'.
Re^2: hex in regexp
by shamanoff (Initiate) on May 22, 2012 at 04:36 UTC

    Sorry, I did not understand your answer at all. You see, I just started to learn Perl and sometimes may not recognize the value of the example shown. My task is to get rid of the non-Ascii symbols which were mixed with Ascii symbols in text file with multiple rows. I am not sure that solutions mentioned in the first reply do the trick. (what is the meaning of $freeStuff and $stuff anyway...). Could you please provide more vivid example or direction.

      See, I assumed an XY Problem . I assumed what you really wanted to do was use an already existing encoder/serializer, instead of inventing your own, so I showed you two which use hex encoded characters. One which only does strings (CGI->escape) and one which does complex data structures (JSON)

      I guess since this might be homework a practical solution doesn't fit :)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://971713]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2018-01-21 18:56 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (229 votes). Check out past polls.