use URI; use strict; use warnings; my $hostname = 'localhost'; my $path = '/cgi-bin/details'; my $period = 4; my $vid = 11; my $person = 'abcdef'; my @args = ( period => $period, vid => $vid, person => $person ); my $url = URI->new("http://$hostname/"); $url->path($path); $url->query_form( \@args ); print $url->canonical;