use strict; use warnings; while () { next if (m/First Name/ .. m/Last Name/); next if ! m/Last Name/; print "Order is not correct\n"; last; } __DATA__ ....... Last Name ...... ....... First Name ....... #### Order is not correct