while() { if( /^process/ .. /end process/ ) { #recognize and skip first delimiter next if /^process/; #recognize and skip end delimiter next if /end process/; # do something with the middle. print; } } #### while() { next if /^process/ or /^end process/; print; }