Replace a line in PERL with other line

Monday, July 7, 2014

I am iterating a file then there is a string for which I have to search for and from that string I have to replace a sub string with another string. Can anyone help me to solve this problem. I tried like this. while() { if($_ =~ /AndroidAPIEventLogging=false/i) {



if($& =~ s/false/True/)
{
print("Changed successfully\n");

}

}

}


Now it is showing that it can perform only read operations. I tried by opening the file in each possible mode.







http://ift.tt/1mpSjPt