use warnings; use strict; while () { print if (/start/i .. /end/i) } __DATA__ foo start checking script end foo