in reply to regex: seperating parts of non-formatted names

How about something like this?
@titles = qw/Dr. Col. Miss/; # list of allowable titles $title_reg = join "|", @titles; $title_reg =~ s/\./\\./g; # make sure the dots are literal while (<>) { / ($title_reg)? # optional title \s* # skip any spaces (\S+) \s+ # first name, skip following spaces ((?:\w\.\s*)+)? # middle initials - any number, optional (\S+) # last name /iox; print "$1, $2, $3, $4\n"; }
note that the middle initial will have trailing spaces, and that this will break if the middle name is spelled out.

-- Dan (who forgot to hit submit last night)