Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Parsing Names in a Text File

by mothra (Hermit)
on Jun 15, 2001 at 20:08 UTC ( [id://88825]=note: print w/replies, xml ) Need Help??


in reply to Parsing Names in a Text File

Easy enough:
open(CUST, "cust_info.txt"); while (<CUST>) { print ((split ('\|'))[1], "\n"); }
Update: My apologies...even after reading the question twice before answering, I still missed what you were trying to do. :)
open(CUST, "cust_info.txt"); while (<CUST>) { $full_name = (split '\|')[1]; $full_name =~ s/(\w)\w*\s+(.+$)/$1. $2/; print $full_name, "\n"; }
is probably more what you're looking for.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-18 23:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found