Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Re: Parsing Names in a Text File

by Anonymous Monk
on Jun 15, 2001 at 20:41 UTC ( #88841=note: print w/replies, xml ) Need Help??

in reply to Re: Parsing Names in a Text File
in thread Parsing Names in a Text File

I'd recommend taking a slight variant on this in order to handle the middle name problem:
while(<FILE>) { my @line = split '|'; # split line #so far as above apart from my declaration #now split on whitespace my @names = split ' ',$line[1]; #same idiom for getting the first letter my $firstletter = substr ($names[0],0,1); #then get the last item in the name array my $lastname = $names[-1]; #now do whatever you want to do with the letter and lastname }
Of course this assumes that all the names are in a givenname middlenames familyname format.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://88841]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2022-08-10 04:37 GMT
Find Nodes?
    Voting Booth?

    No recent polls found