my $content = do{ local @ARGV = 'theFile.htm'; <> }; my $first = index $content, 'Oct-18-2013'; my $last = rindex $content, 'Oct-18-2013'; print substr $content, $first, $last;;