Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Need help understanding some code ...

by Crackers2 (Vicar)
on May 15, 2010 at 23:39 UTC ( #840178=note: print w/ replies, xml ) Need Help??


in reply to Need help understanding some code ...

For completeness sake...

I understand what each line does ... for example ...
$value =~ tr/+/ /;
performs transliteration on $value and thus translates characters like !, @, #, etc. to their hex equivalents ... that is, # becomes %23.

No, all it does is replace plus characters with spaces.

$value =~ s/%(..)/pack("c", hex($1))/ge;
The line above then takes the two "hex" digits that make up the string and packs them into their hex equivalent.

And this does the opposite of what you thought the first line does, i.e. it replaces things like %23 with # etc. (Perhaps that's what you were saying but I couldn't quite tell from your wording)


Comment on Re: Need help understanding some code ...
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2014-10-30 15:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (208 votes), past polls