in reply to Parsing out first names

Like grep. I'd use split, splitting on whitespace.

This will give you a list (which may have one element). Since your list doesn't contain surnames, I'd filter the list grep to eliminate initials, except when their elimination leaves nothing (I know people who use initials in lieu of their given names).

I've got a sample here:

#!perl use strict; use warnings; my @names = ( 'J Q', 'G Gordon', 'Mary Jane', 'Tommy K', 'Madonna', 'George W.', 'Jacques-Yves'); foreach my $name (@names){ my @nl = split(/\s+/, $name); my @list = grep { ! /^[A-Z][^A-Z]*$/i} @nl; pop(@nl) if (@list and $#nl > 0 and $nl[-1] =~ /^[A-Za-z][^A-Za-z] +*$/); $name = join(' ', @nl); } print join("\n", @names) . "\n";
which produces this output:
J Q G Gordon Mary Jane Tommy Madonna George Jacques-Yves

I know it could be both better written and much shorter, but it's intended to be a demonstration, not production code.

emc

At that time [1909] the chief engineer was almost always the chief test pilot as well. That had the fortunate result of eliminating poor engineering early in aviation.

—Igor Sikorsky, reported in AOPA Pilot magazine February 2003.