... I'm still not completely clear what local $/ = ''; does ... perlvar does not discuss what it means to set it like this ...

Quoth perlvar:

IO::Handle->input_record_separator(EXPR)
$INPUT_RECORD_SEPARATOR
$RS
$/
The input record separator, newline by default. This influences Perl's idea of what a "line" is. ... [Treats] empty lines as a terminator if set to the null string. ... Setting it to "\n\n" means something slightly different than setting to "", if the file contains consecutive empty lines. Setting to "" will treat two or more consecutive empty lines as a single empty line. Setting to "\n\n" will blindly assume that the next input character belongs to the next paragraph, even if it's a newline. ...
So yes,  local $/ = ''; sets what you might call "indulgent" (update: or maybe "greedy"?) paragraph mode.
c:\@Work\Perl\monks\Magnolia25>perl -wMstrict -le "my $data = qq{line 1 \n} . qq{line 2 \n} . qq{\n} . qq{\n} . qq{\n} . qq{\n} . qq{\n} . qq{line 8 \n} . qq{line 9 \n} . qq{\n} . qq{\n} . qq{\n} . qq{\n} . qq{line 14 \n} . qq{\n} . qq{\n} . qq{\n} ; print qq{[[$data]] \n}; ;; open my $dfh, '<', \$data or die $!; ;; local $/ = ''; while (<$dfh>) { print qq{block <<$_>>}; } " [[line 1 line 2 line 8 line 9 line 14 ]] block <<line 1 line 2 >> block <<line 8 line 9 >> block <<line 14 >>
Try assigning  "\n\n" to  $/ as an experiment; how many blocks get printed out then?


Give a man a fish:  <%-{-{-{-<


In reply to Re^5: using Path::Tiny and reformating result by AnomalousMonk
in thread using Path::Tiny and reformating result by Aldebaran

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.