#!/usr/bin/perl

use strict;
use warnings;

my $zip = 0;
my %ziphash;
my $badzip = 0;
while(my $line = <STDIN>){
  if($line =~ /Actual City name in <span style="color:#333333;">(\d{5})/){
    $zip = $1;
    $badzip = 0;
    print "Zip: $zip\n";
  } elsif($badzip != 1 && $line =~ /headers="pre"><b>([^<]+)<\/b><\/td>/){
    my $city = $1;
    print "\tCity: $city\n";
  } elsif($badzip != 1 && $line =~ /headers="pre">([^<]+)<\/td>/){
    my $altcity = $1;
    print "\t\tAltCity: $altcity\n";
  } elsif($line =~ /<h2 style="color:#CC0000;">Not Acceptable/){
    print "Done with $zip\n";
    $badzip = 1;
  }
}

print "Done Processing Input\n";

