⭐ in reply to How do you extract the server from a URL?
Use the URI module.
use URI; 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";
|
---|
In Section
Seekers of Perl Wisdom