From -> http://yahoo.co.uk/notfound.html
extract only -> yahoo.co.uk
rhesa already suggested using a specialized module, which yields a superior solution, which is superior because it uses a a specialized module (and that's generally the case), but this shouldn't be hard to do with a match or split, in which case some familiarity with elementary regexen should help you. In particular the following should be fine for you:
my $url='http://yahoo.co.uk/notfound.html'; my $host=(split m(/+), $url)[1];
In reply to Re: Extracting a domain name from a url
by blazar
in thread Extracting a domain name from a url
by abachus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |