http://www.perlmonks.org?node_id=1009808


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