You don't tell us how it does not work. But I'm going to guess. You're running this on Windows. On Windows, it's not possible to recreate a file while still reading from it. That's why you need to set $^I. You can still erase the file afterwards.
Also see the Sysadm::Install module, which has the pie subroutine, which does just what your replace subroutine does.
In reply to Re: $^I why this symbol does not work ?
by Corion
in thread $^I why this symbol does not work ?
by kingwrcy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |