my $query = (split /\?/, $ENV{HTTP_REFERER}, 2)[1]; my $q = new CGI($query); ...