Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!usc!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: PERL dumps core on s/// the third time???? Message-ID: <11673@jpl-devvax.JPL.NASA.GOV> Date: 4 Mar 91 21:26:41 GMT References: <1991Mar4.130949.6450@ugle.unit.no> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 21 In article <1991Mar4.130949.6450@ugle.unit.no> harald.alvestrand@elab-runit.sintef.no writes: : Given the following stuff, PERL will core dump on a Sun-4/490 running : SunOS 4.0.3, if the command line is : : perl bug.perl bug.translate bug.sum : : It attempts to EVAL several s-expressions. Everything seems critical. : The bug in the original program was the check for comment lines, : but still, PERL should not core dump on me, should it???? Your problem is that some of the elements of your pattern array are null, so you're doing s//something/, which makes it look for the previously used regular expression, which, unfortunately, has already been freed because it was in an eval. Your fix is to throw away pattern lines that are null after you strip comments. In 4.0, the using s/// or m// will refer back to the previous pattern that wasn't in an eval. This would still have caused misbehavior in your program, but it wouldn't have core dumped. Larry