in reply to grabbing N lines after matching one?
my $cntr = 0 my $stuff = "" LINE: while(<HTMLFILE>) { if($cntr == 0 && $_ !~ /$myregex/) { next LINE; } last LINE if $cntr >= 5; $stuff .= $_; $cntr++; } [download]