On Thu, 5 Dec 2002, Joseph F. Ryan wrote: > Peter Haworth wrote: > >On Thu, 5 Dec 2002 04:05:05 -0500, Tanton Gibbs wrote: > >>>A string inside a \qq[] construct acts exactly as if it were an > >>>interpolated string. Note that any end-brackets, "]", must be escaped > >>>within the the \qq[] construct so that the parser can read it correctly. > >>> > >>Note that an end-bracket, ], must be escaped within the \qq[] construct. > >>This allows the parser to correctly parse the construct. > > > >Don't embedded qq[] strings obey the normal qq[] rules? That is, will > >all brackets need escaping, or just unbalanced brackets? I'd hope for > >the latter. > > With all of the new crazy quoting shenanagains, I'm not sure that the > "balenced brackets are fine" rule will still be possible; and thus end > delimeters will always need to be escaped. For instance, imagine > what a nightmare this would be to parse: > > $var = qq[blah [\q[blah [\qq[%hash{qq[[hi]]}]]]] blah]; > > Sure, anyone who writes something like this deserves to be shot; > however, if the "balanced brackets are ok" rule still stands, the > above code would be legal. (And I really, really, really don't > want the above code to be legal ;)
Well, just don't do it then. With or without balanced brackets, the obfuscating programmer can do the above; he just needs more or less backslashes. '\qq[]' is the real source of evil here. Actually the apocalypse says: > RFC 226: Selective Interpolation in Single Quotish Context. > > This proposal has much going for it, but there are also difficulties, > and I've come close to rejecting it outright simply because the > single-quoting policy of Perl 5 has been successful. Maybe if we pushed Larry a bit, he could reject it after all? Personally I like 'not interpolated'_"interpolated"_'not interpolated' much better than 'not interpolated\qq[interpolated]not interpolated'. ~ John Williams