On Fri, 14 Nov 2003 01:40:35 -0800, perl wrote:
> I would like to parse the servername to get the base domain or atleast
> x.com, x.org, x.net, etc. from something like www.x.com.

There are modules on <http://www.cpan.org/> to do this for you, but if you
_only_ have the names you mentioned, you could always split into an array
and the retrieve the two last elements of that array;

  my @parts = split( /\./, $host );
  my $left  = $parts[-2] || '';
  my $right = $parts[-1] || '';


-- 
Tore Aursand <[EMAIL PROTECTED]>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to