while (){ $name = everything up to the first space. $rest = everything else if ($rest starts with one of the "van"-type prepositions){ deal with it } else { print "can't parse this one into a name: $_" } }