root/zip2tz/zip2state.pl

Revision 2100 (checked in by miyagawa, 13 years ago)

import zip2tz

  • Property svn:executable set to *
Line 
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4 use LWP::Simple;
5
6 my %zip2state;
7 for (0..99) {
8     my $url = sprintf "http://www.downloadzipcode.com/%02d.html", $_;
9     warn "GET $url";
10     my $html = get $url;
11     while ($html =~ m!<a href="/(\w{2})/(\d{5})/">!g) {
12         $zip2state{$2} = $1;
13     }
14 }
15
16 use YAML;
17 print YAML::Dump \%zip2state;
18
Note: See TracBrowser for help on using the browser.