use warnings; use strict; while () { if (/\w\s+\w/) { print "yes\n"; } else { print "no\n"; } } __DATA__ John Doe Joe John D John John