my $startre = qr/^$start/; my $endre = qr/$end$/; while () { print C $_ if m/$startre/ and m/$endre/; }