err.. wrong.. I found it.. I am a moron.
local $/ = ""; is wrong.
should be:
local $/;

Thanx though... Don't mean to post but it stumped me for about a half hour
(too long for me).


> -----Original Message-----
> From: David Gray [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 26, 2002 4:25 PM
> To: 'Beginners (E-mail)'
> Subject: RE: Regex sub moron problem
> 
> 
> > 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__
> 
> When you do a multi-line match, I'm pretty sure $ matches the 
> end of the
> entire string. Try matching \n instead of $ - I think that 
> should do it.
> 
>  -dave
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

----------------------------------------------------------------------------
--------------------
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]

Reply via email to