Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Parsing Names in a Text File

by runrig (Abbot)
on Jun 15, 2001 at 18:51 UTC ( #88807=note: print w/replies, xml ) Need Help??


in reply to Parsing Names in a Text File

Do it in two steps, it makes it much clearer than coming up with one regex to do everything:
my $str = '380|Kelley Gibson-White|6|0|85|14.2|3|17|.176|8|8|1.000|'; # Get the name my ($name) = (split /\|/, $str, 3)[1]; # Initialize the first name $name =~ s/(\w)\S*\s+(.*)/$1. $2/; print $name;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2022-08-15 13:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?