see URI for parsing URIs. If you just want to get the "main" domain, you could try something like
join(".", ( split(/\./, $domains ) )[-2,-1] ) (if I understand you correctly)
Best regards,
perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"
| [reply] [Watch: Dir/Any] [d/l] |
Erm, you need to clarify what you mean by "logical host". yahoo.com resolves to (for me right at this minute) 66.94.234.13, whereas shopping.yahoo.com is a CNAME to pdb3.shop.yahoo.akadns.net which is yet another IP. Perhaps if you can expand on what your definition of "logical host" is you can get a decent answer.
| [reply] [Watch: Dir/Any] |
You mean something like this?
use strict;
use warnings;
print m/^.*?(\w+\.\w+)$/ while(<DATA>);
__DATA__
shopping.yahoo.com
yahoo.com
some.very.long.url.at.yahoo.com
$ perl -l 632539.pl
yahoo.com
yahoo.com
yahoo.com
| [reply] [Watch: Dir/Any] [d/l] [select] |