| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | #system 'lynx -dump http://www.usps.gov/ncsc/lookups/usps_abbreviations.htm > kruft.txt'; | ||
| 4 | open P, 'kruft.txt'; | ||
| 5 | |||
| 6 | while (<P>) { | ||
| 7 | if (/\w/) | ||
| 8 | { | ||
| 9 | |||
| 10 | $_ =~ s/^\s+//; | ||
| 11 | $_ =~ s/\s+$//; | ||
| 12 | |||
| 13 | if (++$line_count % 2) | ||
| 14 | { | ||
| 15 | $current_state=$_; | ||
| 16 | } | ||
| 17 | else | ||
| 18 | { | ||
| 19 | $code{$current_state}=$_; | ||
| 20 | } | ||
| 21 | } | ||
| 22 | } | ||
| 23 | |||
| 24 | open C, '>codes.dat'; | ||
| 25 | foreach (sort keys %code) { | ||
| 26 | print C "$code{$_}:$_\n"; | ||
| 27 | } | ||
| 28 |