use CGI; my $q = CGI->new(); my $uri = $q->self_url(); $template->process($filename, { uri => $uri }); [% uri %]?somevar=[% totalcost %] If you're using Apache::Template, perldoc Template::Plugin::CGI. - Perrin