in reply to Changing from full name to last, first mid

Try this code...
while (<DATA>) { @name = split /\s/; print pop(@name), ', ', join(' ', @name), "\n"; } __DATA__ John Hand Brown Cindy Jones Thomas More
produces the output...

Brown, John Hand
Jones, Cindy
More, Thomas

Replies are listed 'Best First'.
Re: Re: changing full name to last, first mid
by HollyKing (Pilgrim) on May 24, 2004 at 23:02 UTC

    Then you have someone like me who breaks your code. "Brendan Van Horn" should end up as "Van Horn, Brendan." Nothing against you, but I really get tired of people who think my middle name is Van.

    Owl looked at him, and wondered whether to push him off the tree; but, feeling that he could always do it afterwards, he tried once more to find out what they were talking about.

      Other gotchas:

      Prefixes for last name: De, Del, Dela, Di, Du, El, La, Le, Mac, Mc, San, St., Van, Vanden, Vander, Ver, Von, etc.
      Suffixes for last name: II, III, IV, Sr, Jr, MD, PhD, etc.