http://qs321.pair.com?node_id=1077623


in reply to Replace new line with white space

I suspect that what you really need is chomp, and that you don't need a regex at all.
while (<$fh>) { chomp; # Line in $_ no longer has trailing \n
However, without seeing your code we can't confidently advise you either way.

Replies are listed 'Best First'.
Re^2: Replace new line with white space
by fattahsafa (Sexton) on Mar 10, 2014 at 21:21 UTC
    Thanks for responding. But chomp only trims the new line at the end of the string.