Hi,
I'm currently writing a perl script and it's my first time doing this. So I'm not sure why I can't seem to write to the same file that I am reading. I read somewhere that I cannot read and write at the same time. Is this true? If not, can you help me in solving this writing problem I am having? Below is my code:
my $midtierGS=`ls mtb_*_*_*_hnw_gs.xml`;
my $disclaimer="DYNAMIC_DISCLAIMER_IMPLEMENTED";
my $provider="MKD_CURRENT_DATA_PROVIDER";
open(FILE,"+<$midtierGS") or die "Couldn't open file!";
#read line from file
while ($record = <FILE>) {
#if line contains value
if ($record =~ m/$disclaimer/) {
#go to next line
$nextLine = <FILE>;
#substitute old value for new value
$nextLine =~ s/false/true/;
#save changes to file
print FILE "$nextLine";
}
elsif ($record =~ m/$provider/) {
$nextLine = <FILE>;
$nextLine =~ s/RSF/Comstock/;
print FILE "$nextLine";
}
}
close FILE;