use URI; my $uri = URI->new($url); print $uri->scheme, '://', $uri->host, $uri->path, "\n";