Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Parsing Names in a Text File

by mothra (Hermit)
on Jun 15, 2001 at 20:08 UTC ( #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? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2022-05-22 22:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (81 votes). Check out past polls.

    Notices?