in reply to modify a URL
use URI qw( ); my $url = URI->new(...); my $base_url = $url->scheme . '://' . $url->host; [download]
It doesn't work for all schemes, but it does work for all schemes where your request makes sense. (http, https, ftp, for starters.)
URI