Open nicomen opened 1 month ago
It seems undefining $/ affects the behaviour of the lines method.
$/
lines
$ echo -e "a\nb\n" > foo; perl -MPath::Tiny -wlE 'local $/; print scalar path("foo")->lines' 1
Is this wanted behaviour? I just spent some time debugging an issue with a call to lines deep into code and further out $/ was localized.
Personally I use stuff like Path::Tiny to avoid "clever" globals like $/ having any impact.
If this is intended behaviour, should it be possible to tell lines to ignore $/ or set a custom line-ending character?
If not, should one always define $/ to wanted value before using lines?
And I guess no matter what, the current behaviour of respecting $/ should perhaps be clearly documented.
I think you're right that $/ should be ignored.
It seems undefining
$/
affects the behaviour of thelines
method.Is this wanted behaviour? I just spent some time debugging an issue with a call to
lines
deep into code and further out$/
was localized.Personally I use stuff like Path::Tiny to avoid "clever" globals like
$/
having any impact.If this is intended behaviour, should it be possible to tell
lines
to ignore$/
or set a custom line-ending character?If not, should one always define
$/
to wanted value before usinglines
?And I guess no matter what, the current behaviour of respecting
$/
should perhaps be clearly documented.