in reply to Problem w/ single-quoted strings

I don't know about clear it up, but it looks to me that the text and the behavior do not match. The text more clearly describes what happens in quoted strings, not what happens in single quoted strings as this example shows:

print '\ \\ \\\ \\\\ \\\\\ '; print "\n"; print "\ \\ \\\ \\\\ \\\\\ "; print "\n";
\ \ \\ \\ \\\ \ \ \\ \\

As you can see in the quoted string "\ " displays a space while in the single quotes it displays itself. Thus the backslash does not appear to always be an exception to the every char stands for itself rule. What it stands for appears to depend on what follows it. And sometimes it appears to stand for itself.

perl, v5.8.1-RC3 built for darwin-thread-multi-2level

Replies are listed 'Best First'.
Re: Re: Problem w/ single-quoted strings
by nmcfarl (Pilgrim) on May 13, 2004 at 21:37 UTC

    Ok if you read perlop manpage under q/STRING/ 'STRING' you will find that it perfectly describes what is happening:

    ' A backslash represents a backslash unless followed by the delimiter or another backslash, in which case the delimiter or backslash is interpolated.'