Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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 ]);


Comment on Re: hex in regexp
Select or Download Code
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2015-07-06 08:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls