in reply to Extract Paragraph From Text
Careful, careful ... if this text was simply copy-and-pasted into a <<HereDoc, perhaps the text does not in fact contain the expected end-of-line characters. This could therefore be something as simple (and, not-reproducible, when we try it ourselves ...) as having the wrong record separator specified to Perl. Hard to spot, easy to fix.
What I would do, first, is to look at the Perl source-file with a tool such as hexdump which can display the binary content of the file side-by-side with the characters. Look, within the heredoc section, at how the lines and paragraphs are separated. Exactly what byte sequence is used within that section.
Further confusion can be introduced if you retrieve the file from some source, and, in handling it (e.g. to put it into a heredoc), you inadvertently mess-up the sequence or introduce more, conflicting bytes.
For this reason, it might be advantageous to simply read the source-file directly, instead of attempting to embed it into the code. (Which, I understand, might have been done here for the sake of example ...)
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Extract Paragraph From Text
by perlbeginneraaa (Novice) on Sep 08, 2015 at 15:31 UTC | |
by locked_user sundialsvc4 (Abbot) on Sep 09, 2015 at 22:11 UTC |