Debian Codegraph @

examples/tld

raw
1 #! /usr/local/bin/perl -w
2 #
3 # tld - generate a regular expression that matches the Internet
4 # top level domains
5 #
6 # You can also specify an indent value to pretty-print the
7 # resulting regexp. This example gives you a very good insight
8 # as to how the alternations are sorted, busiest to least.
9 #
10 # Copyright (C) David Landgren 2005
11
12 use strict;
13
14 use Regexp::Assemble;
15
16 my $indent = shift || 0;
17
18 eval "use Net::Domain::TLD";
19 $@ and die "You must install Net::Domain::TLD to run this example\n";
20
21 my $re = Regexp::Assemble->new->add( Net::Domain::TLD->new->All );
22
23 print $re->as_string(indent => $indent), "\n";