![]() |
|
laziness, impatience, and hubris | |
PerlMonks |
Re: Parsing Names in a Text Fileby davorg (Chancellor) |
on Jun 15, 2001 at 18:30 UTC ( #88802=note: print w/replies, xml ) | Need Help?? |
You're using the escape sequence \w to match characters in the surname. \w matches the characters A-z, a-z, 0-9 and the underscore (_). Your example contains a dash (-) character, so you'll need to add that to the list of allowed characters. Something like this will work: s/^([A-Z])\w*( [-\w]+)$/$1.$2/gPerl Training in the UK <http://www.iterative-software.com>
In Section
Seekers of Perl Wisdom
|
|