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.