in reply to how to use matching operator on newlines

use strict; use warnings; my $text = do {local $/; <DATA>;}; $text =~ s/\n\n/\n/g; print $text; __DATA__ line 1 line 2 line 3

Prints:

line 1 line 2 line 3

which is what I would expect. What are you doing that is different?


DWIM is Perl's answer to Gödel