while( <> ) { do { print; last } if /^MYTAG2/; } print while <>;