#!/usr/bin/perl use warnings; use strict; while () { if (my $flipflop = /start/ .. /end/) { print "$flipflop: $_"; } } __DATA__ before start 1 2 3 end after