Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.jpl.nasa.gov (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: eval failures - in a commented line Keywords: cgrep, eval bug report Message-ID: <1991Jun24.212752.11784@jpl-devvax.jpl.nasa.gov> Date: 24 Jun 91 21:27:52 GMT References: <1991Jun21.194148.24804@cbnewsh.att.com> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Distribution: na Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 26 In article <1991Jun21.194148.24804@cbnewsh.att.com> ijk@cbnewsh.att.com (ihor.j.kinal) writes: : While trying to extend cgrep', I ran into an interesting problem. : The eval part of the program failed [silently]. Since I had made a number : of changes, I tried commenting them out, to no avail. Finally, by deleting : lines, I determined the failure was within a commented line that : had a print format: : # print \$ary[\$ind], "\n"; : : By deleting the "\n", then program then seemed to work as before. : : Is this a bug, or what??? It's what. You're obviously evaluating this in a double-quote context, or you wouldn't be backwhacking the dollar signs. (It's also obvious that you're not using double quotes to get the double-quote context, or you WOULD be backwhacking the double quotes.) Recall that double-quote context also interpolates things like \n. Recall also that comments run to the next newline, and you'll see that the second double quote above is on the next line after the comment, if the newline gets interpolated too early, which it is. It doesn't matter without the comment, since Perl can have newlines embedded in a quote. To fix it, put \\n instead. Larry