#!/usr/bin/perl use strict; my $start_pattern = ''; my $end_pattern = ''; my @files_to_look_in = ("/path/to/files1.html", "/path/to/files2.html"); for(@files_to_look_in) { local $/; open(HTM_FILE, <$_) || die "Can't open file: $!"; my $file = ; if ($file =~ /$start_pattern(.*)$end_pattern/s) { print "$1"; } }