I have a file with some settings, and I want to change some of them.
But when I write the file, I lose everything after a certain point.
Can someone point out my moronic mistake?
Everything after "ROOT =" is lost but it changes "ROOT =" to the correct
value.
# perl here
$out = "";
open(TMPL, "$tree_path/$file");
{
local $/ = "";
$out = <TMPL>;
}
close TMPL;
open(NEW, ">$tree_path/$client_uc/$patch/$file");
$out =~ s/^ROOT\s*=\s*.*?$/SUMMITROOT=$tree\/$extra/m; # replace
root line
$out =~ s/^#(un)?def(ine)?\s+REFROOTDIR.*?$/#define REFROOTDIR
$old$extra/m; #replace refrootdir line
print NEW $out;
close NEW;
print "Edited $tree_path/$file\n";
__END__
Thanx
Nikola Janceski
The day after tomorrow is the third day of the rest of your life.
-- George Carlin
----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]