#!/usr/bin/perl

$file = shift or die "require filename\n" ;
unless (-r $file) { die "cannot read $file\n" ; }

open (IN,$file) or die "cannot open $file\n" ; 
while (<IN>) {
  chomp ;
  if (/<h1>(.*)<\/h1>/) { $h1 = $1 ; }
  if (/^(.*),  BC, <p>/) { $ad = $1 ; }
  if (/^,  , <p>/) { $noad = 1 ; }
  if (/^Tel: <br>/) { $notel = 1 ; }
}
close(IN) ;
if ($h1 eq $ad) {
  print "$file Match $ad - remove\n" ;
  unlink $file ;
} 
if ($noad and $notel) {
  print "$file No address/phone - remove\n" ;
  unlink $file ;
} 

