[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

RE: [p5p] pod bugs



Paul Moore <Paul.Moore@uk.origin-it.com> writes:
>From: Tom Christiansen [mailto:tchrist@chthon.perl.com]
>> I think what we're getting down to is that $/ = '' is a problem.
>> Nobody ever understands what it really means, and constantly 
>> tries to rehack programs that use it.
>
>I think this is the crux of things. Specifically, from perldoc perlvar
>
>    $/      The input record separator, newline by default. This is used
>            to influence Perl's idea of what a "line" is. Works like
>            awk's RS variable, including treating empty lines as
>            delimiters if set to the null string. (Note: An empty
>            line cannot contain any spaces or tabs.)
>
>That note is the key. Maybe the simple answer is "just" to change the effect
>of $/='' to split on empty lines, where empty matches /^\s*$/ rather than
>just /^$/.

I was going to suggest that too. I happen to use an editor (which I wrote
so I have no one to blame but myself) which if you "click" beyond the end
of a line extends the line to that point with white space. 
This was deliberate as it makes it more intuitive to me. BUT it has 
side effect that it is too easy to add invisible spaces at the end of lines.

Note too that $/ = '' already does semi-magical things when "\n" is CRLF
rather than just LF - i.e. it already ignores \r whitespace - it is not 
too huge a jump to ignore ' ' and \t whitespace too.

-- 
Nick Ing-Simmons


Follow-Ups from:
Gurusamy Sarathy <gsar@ActiveState.com>
References to:
"Moore, Paul" <Paul.Moore@uk.origin-it.com>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]