Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Read Text line by line & modify with a delimiter

by 2teez (Priest)
on Dec 20, 2012 at 22:07 UTC ( #1009808=note: print w/ replies, xml ) Need Help??


in reply to Read Text line by line & modify with a delimiter

Or this:

chomp( my @names = <DATA> ); $" = "|"; print "@names"; __DATA__ Matei Janov rebas yoni
Output:
Matei|Janov|rebas|yoni

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me


Comment on Re: Read Text line by line & modify with a delimiter
Download Code
Re^2: Read Text line by line & modify with a delimiter
by RFMonk (Acolyte) on Dec 20, 2012 at 23:50 UTC
    Use something like:
    print join ("|", $name1, $name2);
Re^2: Read Text line by line & modify with a delimiter
by Anonymous Monk on Dec 21, 2012 at 04:28 UTC

    Thx, but how can i delete a leading spaces or trailing space from the names, Is it possible?

    Thx for your help.

      Have a look at regexes

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2014-07-11 03:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (218 votes), past polls