He is assuming that all paragraphs end that way. For example, these two paragraphs would be counted as one:

    One day I found myself at the river, again thinking
about what happened that day. The water was cold,
didn't really help me relax. What a predicament!
    How could someone be so cold? Did I say
the wrong thing? And where was Charlie Sheen? I mean,
this was all his fault.

As you can see, there are clearly two paragraphs, but the last sentance of the first one breaks our "paragraph mode." So yes, you are correct, this doesn't catch every paragraph. We would need to specify that question marks and exclamation points would also constitute the end of a paragraph.

I tried to set $/ to a character class, but I don't think it is possible. The Camel Book says that it can be set to a multi-character delimiter, but nothing about a class of characters.

I assume that the author was using 'auto-wrap' and never actually typing a newline until the end of a paragraph.

hope this helps,
jeff


In reply to (jeffa) Re: Setting Input record separator to chunk on paragraphs by jeffa
in thread Setting Input record separator to chunk on paragraphs by princepawn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.