use CGI; use URI::Escape; # here put code that prints out the page header, etc. my $secondurl = 'http://www.myothersite.com/myotherwebapp2/foo.asp?param=1¶m=3'; my $initialurl = 'http://www.mysite.com/mywebapp1/dosomething?' . 'url=' . uri_escape($secondurl); print 'launch mywebapp'; # code that does that does the page footer #### sub queryToHTML { my ($uri, %param) = @_; my ($sepchar) = '?'; if (!%param) { $sepchar = ''; } elsif ($uri =~ /\?/) { $sepchar = '&'; } return CGI::escapeHTML( $uri . $sepchar . join '&', map {uri_escape($_) . '=' . uri_escape($param{$_})} keys(%param) ); }