Tom Allison wrote:
> I keep getting hung up on what I think would be a simple problem.
> 
> I was to do approximately this:
> 
> Given an array of "stuff" print them out
> print join(",", @row),"\n";
> 
> works great until your array elements contain dumb characters like \n\r
> somewhere in the string (not always at the end!).
> 
> Initially I thought I could do:
> 
> print join(",", map(s/[\r\n]+//g, @row)), "\n";
> print join(",", map{s/[\r\n]+//g} @row), "\n";
> 
> but I get output like:
> ,,2,,
> ,,,,
> telling me how many of these I actually matched...
> 
> I can't be that far off, can I?

Not too far off.

print join( ',', map { s/[\r\n]+//g; $_ } @row ), "\n";



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to