#!/usr/bin/perl $goprint=0; while (<>){ if ($_ =~ /^Start(.*)/){$goprint=1} if ($_ =~ /^END(.*)/){$goprint=0;next} print "$_" if $goprint == 1; } #### #Here's code that finds everything #between START and END in a paragraph: undef $/; # read in whole file, not just one line while ( <> ) { while (/START(.*?)END/sgm) { # /s makes . cross line boundaries print "$1\n"; } }