in reply to Parsing Names in a Text File
I would pass on using a regex for this one.
Jeremywhile(<FILE>) { @line = split '|'; # split line $firstLetter = substr $line[1], 0, 1; #grab first letter $lastName = (split(' ', $line[1]))[1]; #split the name entry on wh +itespace and grab the last name portion $name = $firstLetter . ". " . $lastName; #concatenate with period +after first letter }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Parsing Names in a Text File
by Anonymous Monk on Jun 15, 2001 at 20:41 UTC |
In Section
Seekers of Perl Wisdom