Any documentation for $^I in perl?

Viewed 161

I have used $^I in a perl script to search and replace conditionally. I want to know whether $^I makes a copy of the file in the buffer and write backs entire buffer back to file after processing the buffer or it does in line editing.

The code is as follows

$^I = "";
my $flag = 0;

while ($line = <>) {
    if($line=~ m/some string/i) {
        $flag = 1;
    }
    if(!$flag) {
        $line =~ s/string/replace/g;
    } 
}

print $line;
1 Answers
Related