Hi,
I'm looking for a perl snippet that can do what the host part of parse_url (PHP) does! Who can help me out?
Code:
parse_url -- Parse a URL and return its components
http://www.php.net/manual/en/function.parse-url.php
Example:
$referer = parse_url(http://www.domain.com/dir/subdir/page.html);
$referer = $referer[host];
$referer will print: www.domain.com
Currently I'm using the following snippet... But it isn't parse url ;-)
Code:
my $referer = "http://www.domain.com/dir/subdir/page.html"
$referer =~ s|^http://([^/]+).*|$1|i;
Greeting,
cK