Imagist has asked for the wisdom of the Perl Monks concerning the following question:
I have to become familiar with a piece of code that I'm going to be working on, but the following code is giving me problems:
$value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
I have no idea what it does! I understand that it's a regular expression, but while I have some understanding of how regular expressions work, I don't understand this, especially the pack("C",hex($1)) part.
Now, what it's supposed to be doing right now is filtering out special characters, but it seems to me that it should be filtering out all the letters of the alphabet after F too, so I'm not sure what's going on. Could somebody help?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regular Confuscion
by liverpole (Monsignor) on Jan 31, 2007 at 20:11 UTC | |
by Imagist (Initiate) on Jan 31, 2007 at 20:20 UTC | |
|
Re: Regular Confuscion
by Joost (Canon) on Jan 31, 2007 at 20:37 UTC | |
by grinder (Bishop) on Jan 31, 2007 at 22:30 UTC | |
by monarch (Priest) on Feb 01, 2007 at 08:27 UTC | |
by Joost (Canon) on Feb 01, 2007 at 10:55 UTC | |
|
Re: Regular Confuscion
by GrandFather (Saint) on Jan 31, 2007 at 20:30 UTC | |
|
Re: Regular Confuscion
by philcrow (Priest) on Jan 31, 2007 at 20:22 UTC |