sub modify_query_str { #takes the parameter you wish to modify and the value you wish to set it to. return $ENV{'QUERY_STRING'} unless(scalar @_ == 2); my ($key, $value) = @_; #Below is the substitution used in CGI::Util for the escape function. $value =~ s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg; my %values = map{split /=/,$_;} split /&/, $ENV{'QUERY_STRING'}; $values{$key} = $value; return join("&", map{"$_=$values{$_}"}keys %values); }