Data munging continued

#!/usr/bin/perl -w

use strict;

my $input_file = 'dealers.txt';

open my $in, '<', $input_file or die "open($input_file): $!";

my $region = '';

while(<$in>) {
  if(/^([a-zA-Z ]+):\s*$/) {
    $region = $1;
    next;
  }
  if(/^(\w+)\s+(\w+)\s+(\S*?@\S+)\s+(\d+(?:\s+\d+)*)/) {
    print "INSERT INTO dealer VALUES (",
          "'$1', '$2', '$3', '$4', '$region');\n";
  }
}