Create a perl hash from a query string

Posted by robbiebow on 8 October, 2009 under geek, perl | Be the First to Comment

Example:

use URI::Escape qw( uri_unescape );

my $query_string = "num=1&colour=red%26blue&size=12&item=skirt";
my %hash = uri_unescape( split /[&=]/, $query_string );