Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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

Replies are listed 'Best First'.
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?
holli gotta grab some groceries before dawn. l8ters
[erix]: s/dawn/dusk/
[erix]: (you're welcome :P)
[james28909]: you know, i had a thought a few mnths back. what if this universe were just a puzzle, waiting for life to figure it out!
[james28909]: what if one day we are able to grab the curtain that is "spacetime" and pull it back to reveal <insert imagination here> pulling at levers and ropes xD
[holli]: like dorothy?
[james28909]: see ya later holli
[james28909]: yeah like wizard of oz lol. its just a joke though
[james28909]: i cannot understand how someone cant see that a cloud of gas that evolves into a solar system or galaxies. it just makes sense to me. everythign that has happened, had to have happened for anything on this planet to be.
[james28909]: /gas/gas and debris/

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (14)
As of 2017-12-15 14:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (433 votes). Check out past polls.

    Notices?