sub new_self_url { my %params = @_; my $new = new CGI($cgi); foreach(keys %params) { $new->param($_,$params{$_}); } return $new->self_url; } # now you can get urls back to your script with different # dates like this: my $newyears = new_self_url(month => 1, day => 1); my $christmas = new_self_url(month => 12, day => 25);