[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] bug?



Alan Fry writes:
|On Sat, 26 Jul 1997 15:14:54 -0500 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}
|The nub of the problem seems to be that Perl interpolates an escaped
|closing bracket (which it shouldn't in a single quoted string)

Actually, it should, otherwise you couldn't include it in the string.
In a single quoted string, the closing quote and the backslash are
the only things interpolated.

For example, when using ordinary single quotes:

print '\\ \' \"' -> \ ' \"

only the escaped backslash and closing quote are interpolated. However,
because the opening and closing quotes are the same, it appears that both
the opening and closing quotes are interpolated, thus perhaps leading one
to expect both opening and closing quotes to always be interpolated. This
isn't the case, so Chris is seeing correct behavior when perl is only
interpolating the escaped closing quote. It's not a bug.

Brian

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch