Code: $text = "This is not good,\n you know what I mean?\n\nThis should be on a separate line."; $text =~ s/[^\n]\n[^\n]//g; print $text; Run: C:\Perl>perl test.pl This is not goodyou know what I mean? This should be on a separate line. Should Print: This is not good, you know what I mean? This should be on a separate line.