in reply to Re^4: Make select apply to modules as well
in thread Make select apply to modules as well

I believe that you have correctly identified the problem.

This is documented, but obscurely. If you check in perlvar you'll find that $^I is the current value of the in-place edit. If you check in perlrun you'll find that -i calls select.

I would suggest avoiding $^I and writing the code that it saves for you. Alternately call select before setting $^I to get the currently selected filehandle, and then call select when the edit is done so that $^I and select play nice with each other.

  • Comment on Re^5: Make select apply to modules as well

Replies are listed 'Best First'.
Re^6: Make select apply to modules as well
by richz (Beadle) on Dec 05, 2004 at 22:13 UTC
    Thanks bro. After looking some more I realized it probably does affect something because when doing the in-place edit a print without specifying a filehandle prints to the file. I am just going to save the filehandle before I do the in-place edit and then restore it.

    Thanks again.