Kiko has asked for the wisdom of the Perl Monks concerning the following question:
I have an array that has some characters in it as well as new lines. I want to remove all the new lines and if there is a place where there is more than one newline together (i.e text\ntext2\n\ntext3) i want to remove them as well.
i.e
if the input is text\ntext2\n\ntext3\n, i want the results to be text,text2,text3 so then i can split the array using a comman as the delimeter.@test = pram("test"); foreach (@test) { s/(\n)*/,/; }
Thanks,
Kiko
Edit: chipmunk 2001-05-31
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Substitution
by runrig (Abbot) on May 31, 2001 at 23:35 UTC | |
by Kiko (Scribe) on May 31, 2001 at 23:45 UTC | |
by lestrrat (Deacon) on May 31, 2001 at 23:55 UTC | |
by baku (Scribe) on Jun 01, 2001 at 09:36 UTC | |
|
Re: Substitution
by DBX (Pilgrim) on May 31, 2001 at 23:43 UTC | |
|
Re: Substitution
by lestrrat (Deacon) on May 31, 2001 at 23:44 UTC | |
|
Re: Substitution
by myocom (Deacon) on May 31, 2001 at 23:49 UTC | |
|
Re: replacing one or more newlines with commas
by larryk (Friar) on Jun 01, 2001 at 14:56 UTC |