On Wed, 16 Jan 2002, Scott Lutz wrote: > > $DOM_NAME, my $TLD) = split(/\./, $domain); > creates two variable out of an inputted domain name, > > until this comes along: > domainname.org.uk > > which it interprets as : > $DOM_NAME = domainname > $TLD = org > > so is it possible to do a 'greedy split' ??
This might work (untested): my $host1 = 'hr.foo.com'; my $host2 = 'web.hr.foo.com'; my $host3 = 'foo.com'; foreach my $host ($host1, $host2, $host3) { my ($dom, $tld) = (split /\./, $host)[-2, -1]; print "dom: $dom, tld: $tld\n"; } Christopher -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]