perl regex substitution help

I want to convert all kinds of %xx, which you can get, when using URS, to normal characters.

For example %20 is space

I tried this:
Code:
$ARGV[0] =~ s/%([[:xdigit:]]{2})/\x{$1}/g;
But unfortunatly it is cousing compile time error.

Can anyone give me a hint how to do this?
I don't want to manually specify each possibility for %xx


I hope I was clear enough and this makes sence :)
 
Code:
sub decodeURL {
 $_ = shift;
 tr/+/ /;
 s/%(..)/pack('c', hex($1))/eg;
 return($_);
}

Found here :e
 
Back
Top