Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 chanting in the Monastery: (8)
As of 2015-07-06 04:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls