http://qs321.pair.com?node_id=88802


in reply to Parsing Names in a Text File

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/g

--
<http://www.dave.org.uk>

Perl Training in the UK <http://www.iterative-software.com>