in reply to Decoding part of URL
I'd recommend one of the various CGI modules out there, they are usually very well tested and provide such functionality.