URL Snippet (Perl)
Friday, February 17, 2006
Perl snippet of code to URL encode or decode a string.
URL Encode:
$str =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
URL Decode:
$str =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg;
Labels: Perl
posted by Don @ 11:20 AM, , link to this post
About This Blog
This blog is a place where I hope to put the snippets and trimmings of my geek'dom ... code samples that have served me well, tech links and other such things that'll I find useful. In short, any time I have to Google something, I tend to post it here for others to find as well.
Also, having owned 'digital-penguin.com' for many years and having worked with many a fellow geek, this site also serves as a place where I can always be found.
