Q&A > CGI programming > How do you extract the server from a URL? - Answer contributed by Mr. Muskrat
Use the URI module.
my $url = 'http://www.perlmonks.org/index.pl';
my $uri = URI->new($url);
my $server = $uri->host;
print "URL: $url\n";
print "Server: $server\n";
There is no Extraterrestrial life
There aren't any suitably capable Extraterrestrials
Interstellar travel is too difficult
We're too uncool / not worth the trouble
What do you mean they haven't visited?
Results (473 votes). Check out past polls.