On Sat, 26 Jul 1997, pudge@pobox.com (Chris Nandor) wrote: > Can anyone confirm whether or not this is correct behavior? > > print q{\{this # and that\}} > > I would expect this to print: > > {this # and that} > > But it prints: > > \{this # and that} > > And ... > > print q{{this # and that\}} > > returns: > > # Can't find string terminator "}" anywhere before EOF. > > This to me seems like a bug. I can understand treating { specially > throughout, but then it should be able to be escaped, as ' would. > > I further confirmed the problem in perl5.00401, so unless I hear there is a > good reason for this, I'll report it to perlbug. > > -- > Chris Nandor pudge@pobox.com <http://pudge.net/ > %PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6']) > I think I can confirme this behavior. I am using Perl 5.003_02 under NeXTStep OPENSTEP 4.1 print q{ \{this # and that\} } prints: \{this # and that} print q{ {this # and that\} } yells: Can't find string terminator "}" anywhere before EOF print q{ {this # and that} } prints: {this # and that} But I think that this behavior is normal. As you define "{" as opening bracet, Perl expect you to use "}" as closinbg bracet, and as q// does not interpolate, the only allowed interpolations are "\\" and "\}". I think that the following lines can help. print q{ \\ } -> \ print q{ \{ } -> \{ print q{ \} } -> } print q{ { } -> Can't find string terminator "}" anywhere before EOF print q{ { } } -> { } print q{ \{ } } -> Unmatched right bracket print q{ { \} } -> Can't find string terminator "}" anywhere before EOF print q{ \{ \} } -> \{ } I don't know how exactly Perl works when compiling this operator, but it appears that it tries to search another string delimiters in a first pass, then just consider them as normal characters in a second pass. Indeed, this bug appears with the other bracets : print q[ [ ] -> Can't find string terminator "]" anywhere before EOF print q( ( ) -> Can't find string terminator ")" anywhere before EOF print q< < > -> Can't find string terminator ">" anywhere before EOF In fact this appears as if Perl "forgot" to remember that it has already seen the opening bract, and that the next should so be considered as normal characters... or perhaps this is an undocumented feature ! :-) > > > ***** Want to unsubscribe from this list? > ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch ------------------------- APERGHIS-TRAMONI Sebastien Word Wide Web : http://www.resus.org/~madingue E-Mail : madingue@cis.uni-muenchen.de (madingue@tango.resus.univ-mrs.fr) ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch