use strict; use warnings; while () { print "--> $_"; if ( /^2/ ) { break; } print "--> $_"; } while () { print "==> $_"; }