diff options
author | lookshe <lookshe@fumuga.com> | 2012-11-09 20:04:06 +0100 |
---|---|---|
committer | lookshe <lookshe@fumuga.com> | 2012-11-09 20:04:06 +0100 |
commit | 2f1137c606eaa5e599b83a53b5187e6970348852 (patch) | |
tree | e56df731d16659adbe520dd14ab0a6f21c593c4c | |
parent | e4b9d6247f1c9233b07c1472b11356a3eea9dc21 (diff) |
message if not found a tld
-rw-r--r-- | tld.pl | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -23,6 +23,7 @@ my $scrap = scraper { my $url = URI->new("http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains"); my $res = $scrap->scrape($url); my $table = $res->{'table'}; +my $found = 0; for ($i = 0; $i < $#$table; $i++) { if ($$table[$i] =~ /^\.[^ ]*$/ && $$table[$i+1] !~ /^No$/ && $$table[$i+1] !~ /^Yes$/ && $$table[$i+1] !~ /^Partial\[/ && $$table[$i+1] !~ /^$/) @@ -31,6 +32,7 @@ for ($i = 0; $i < $#$table; $i++) if ($$table[$i] =~ /^$type$/) { print "$type is $$table[$i+1]\n"; + $found = 1; break; } $i++; @@ -42,9 +44,14 @@ for ($i = 0; $i < $#$table; $i++) if ($$table[$i+1] =~ /^$type$/) { print "$type is $$table[$i+2]\n"; + $found = 1; break; } $i+=5; next; } } +if ($found == 0) +{ + print "$type is unknown\n"; +} |