in reply to Perl 'grammar'
So, grab what you want from what you're given, transform it into what you want, then return it. It's often best to do this sort of thing in a function because it's easier to be destructive and smaller scopes give you greater flexibility. You don't have to watch out for anyone else's feelings. :-)# Starting with Lastname, Firstname # Wanting to get to FLastname sub transform { my ($name) = @_; $name =~ s/^\s*(\S+),\s(\S)/${2}${1}/; return $name; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl 'grammar'
by nedals (Deacon) on Jan 08, 2008 at 23:41 UTC | |
by dragonchild (Archbishop) on Jan 09, 2008 at 00:00 UTC | |
by ysth (Canon) on Jan 09, 2008 at 08:35 UTC | |
by dragonchild (Archbishop) on Jan 09, 2008 at 14:23 UTC | |
by ysth (Canon) on Jan 09, 2008 at 16:26 UTC |