while(<>) { if (/first-line-pattern/ .. /last-line-pattern/) { do your stuff; } }