#!/usr/local/bin/perl -w use strict; my $filename = 'filename with HTML'; my $match = 'your criteria here'; { my $data; # # Use braces to localize the $/ assignment, so we don't get bitten later. # { local $/ = undef; open (FH, "<$filename") || die; $data = ; close FH; } # # @list will contain all the / pairs # my @list = $data =~ m/(.*?)<\/tr>/igs; # # @newlist will contain all the / pairs that match our search criteria # my @newlist = grep { /$match/i } @list; # # Display the number of / pairs total, and the number that matched the search criteria # print "Items total : ", scalar @list, "\n"; print "Items found : ", scalar @newlist, "\n"; }