in reply to undef $/ to null

There's no null in Perl. Oddly enough, undef sets the value to: undef.

Minimize the area in which you change $/ by using local. It even has the fortunate side effect of setting the localised variable to undef.

{ local $/; ... $/ is undef here ... } ... $/ is restored here ...