Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: hex in regexp

by Anonymous Monk
on May 22, 2012 at 03:29 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-23 13:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found