in reply to Re^3: Perl 'grammar'
in thread Perl 'grammar'

Last names often contain spaces.

Replies are listed 'Best First'.
Re^5: Perl 'grammar'
by dragonchild (Archbishop) on Jan 09, 2008 at 14:23 UTC
    Assuming they don't also contain commas and always start and end with a non-space ... s/^\s*(\S(?:[^,]*\S)?)\s*,\s+(\S).*$/${2}${1}/; Update: Fix for ysth's objections.

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?