perl urlencode without libs
$url = “Foo bar com.dx?q=23″;
$url =~ s/([^\w\-\.\@])/$1 eq ” “?”+”:
sprintf(”%%%2.2x”,ord($1))/eg;
print $url;
I don’t remember where I got this, but it must have come in handy for me at some point. Never hurts to have this kind of stuff laying around, just in case.


August 15th, 2006 at 1:24 pm
I think I may already have something like this in my Clint::whatever libraries.. but man.. I’m totally saving that snippet into my perl-NOTES.txt file :)