On Nov 14, [EMAIL PROTECTED] said:

>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.

You're sure you won't run into www.foo.co.uk domains?

>I think what I want is the value of the left and right of the last dot.

Here's one way:

  ($last_part) = $domain =~ /.*\.(.*\..*)/;

A slightly more verbose way is:

  $last_part = substr(
    $domain,
    1 + rindex($domain, '.', rindex($domain, '.'))
  );

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


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

Reply via email to