Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Answer: How do you extract the server from a URL?

by Mr. Muskrat (Canon)
on May 23, 2003 at 17:30 UTC ( #260408=categorized answer: print w/replies, xml ) Need Help??

Q&A > CGI programming > How do you extract the server from a URL? - Answer contributed by Mr. Muskrat

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";

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[holli]: You see, I have a friend whose daughter has been damaged seriously because she wasn't vaccinated against measles. (Her mother being anti-vaxx).
[LanX]: Contrary to Olivia newton John I don't like physical confrontations ...
[LanX]: Oh, you spread measles in your saliva?
[LanX]: ... and why did you bite hos daughter?
[LanX]: *his
[holli]: And this guy was also Anti-Vaxx and I just snapped. I shoed him all over the yard
[james28909]: biting between the legs? now thats my kind of religion.
[holli]: and back into the building, saw him later peeking out of the window looking scared. It was hilarious.
[LanX]: Let's get physical...
[james28909]: wish i could stay and chat. i have an unsuspecting client to give an estimate to. muhhahaha

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2017-12-13 18:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (373 votes). Check out past polls.

    Notices?