in reply to Matching problem

If you are opening the html file and reading into a scalar i.e.
use strict; my $input = "somefile.html"; open (INPUT, $input) || die; my $content = <INPUT>; close INPUT;
it will just pick up the first line in the file. Instead you want to either a) read the file into an array, or b) use LWP::Simple to get the page into a scalar i.e.
use strict; my $content = LWP::Simple::get($input);

elbow