stabu has asked for the wisdom of the Perl Monks concerning the following question:

when reading in a file, how come if I $/='', the file is read in by paragraphs?
I mean, a paragraph is essentially two contiguous newlines, not merely *nothing*, which is what $/='' sets the input record separator to.
I would have thought $/='\x0A\x0A' would read the file in by paragraphs.

Replies are listed 'Best First'.
Re: input record separator
by itub (Priest) on Jul 29, 2005 at 23:47 UTC
Re: input record separator
by fauria (Deacon) on Jul 30, 2005 at 00:29 UTC
    Well, a paragraph is not exatly two \n's, but blank spaces till next character. By using '' (null), a paragraph is meant to be the next text section, no matter how many new lines are in between.

    You are right if assuming paragraphs delimited by a single blank line, but this is not true for every single paragraph.
Re: input record separator
by holli (Abbot) on Jul 30, 2005 at 09:13 UTC
    It's magic ;-)


    holli, /regexed monk/