$result = join '&', sort split '&', $result; #### my %hash = map { split '=', $_ } split '&', $result;