while ( my $raw = ) { next unless $raw; my $uri = URI->new($raw); print $uri->host, $/; my ( $bad_assumption_helper ) = $uri->host =~ /([^.]+)\.(?:\w\w\w|\w\w\.\w\w)\z/; print "\t", $bad_assumption_helper, "\n"; } __DATA__ http://shopping.rediff.com/ http://sportsillustrated.cnn.com/?cnn=yes http://edition.cnn.com/ http://en.wikipedia.org/ http://search.cpan.org/ http://news.bbc.co.uk/