in reply to How to remove extra line breaks (using regexp)?

How can you tell which line break to keep so it doesn't turn into
A6.8.5 This is a example sentence A6.8.6 This is a example sentence
Will the line always start with /A\d+\./?

Replies are listed 'Best First'.
Re^2: How to remove extra line breaks (using regexp)?
by larus (Acolyte) on Apr 17, 2009 at 14:12 UTC
    Well, yeah, that is the problem. There is other shitty thing also in this .txt file that I'm trying to clean but basically the lines that I want to keep starts with a letter and a digit.
      my $file = do { local $/; <DATA> }; $file =~ s/\n(?!A\d+\.)/ /g; $file .= "\n"; print $file; __DATA__ A6.8.5 This is an example sentence A6.8.6 This is an example sentence
      A6.8.5 This is an example sentence A6.8.6 This is an example sentence
        Thanks!!!