in reply to Re: Re^2: If I Want Backslashes, I'll Ask For Backslashes
in thread If I Want Backslashes, I'll Ask For Backslashes

Here's my, possibly skewed, reasoning as to how it should work, at least in one sense:
$_ = '\\something'; # \\something $_ = 'It\'s a tragedy'; # It's a tragedy $_ = '\\''; # \'
Of course, the last example would probably strike many a C programmer as being far too bizarre to comprehend.

This is why I expected the q() operator to behave differently. As it was pointed out, the only reason for \\ is because of the requirement for \', which would imply that if \' were no longer an issue, \\ would cease to be relevant as well.

Here's what I would expect, and yet this is not the case:
$_ = q[\\something]; # \\something $_ = q[It's a tragedy]; # It's a tragedy $_ = q[\']; # \'
Update:
The last "should" example is parsed as such:
',\,\','
That is to say, that this is really a single quote, followed by a single backslash, followed by the token \', followed by a single quote.

Replies are listed 'Best First'.
Re: Re^4: If I Want Backslashes, I'll Ask For Backslashes
by John M. Dlugosz (Monsignor) on Aug 11, 2001 at 07:02 UTC
    I don't understand your last "should" example. But I agree that it makes sense that the reason you need to escape would follow the closing delimiter. So in qq/blab/ you would need to escape out any contained / character, but not any ' character.