http://qs1969.pair.com?node_id=87385


in reply to inplace file editing

I think the difference does not have to do with the use of $^I, but with how $/=undef behaves when reading from the magic <> file handle. The following program:
$^I=""; undef $/; while(<>) { print "hello:\n" }
Behaves the same if I comment out the $^I line: it prints "hello" twice, except that when $^I="" it is printed to the file I give as argument, obliterating it. Printing $_ on each iteration shows that $_ contains '' (empty string) on the second iteration, so my guess is that setting $/ to undef somehow changes the way in which perl reads from <>, but I don't really have an answer...

--ZZamboni