in reply to
replacing one or more newlines with commas
It sounds like what you probably want is to read the entire file into a scalar, then split it on multiple newlines:
my @text = split(/\n+/,$file);
[download]
Now @text should have text,text2,text3. You don't need the intermediate step of converting newlines to commas in order to split.
Comment on
Re: Substitution
Download
Code
In Section
Seekers of Perl Wisdom