From: Mark Hubbart Date: 2005-11-20T10:48:39+09:00 Subject: Re: Trailing \ in %q[\a\b\c\] not treated as literal??? On 11/19/05, Richard Lionheart wrote:> Hi,>> I ran the following on a WinXP/SP2 machine:>> F:\>ruby --version> ruby 1.8.2 (2004-12-25) [i386-mswin32]>> F:\>ruby -e "puts %q[\a\b\c]"> \a\b\c>> F:\>ruby -e "puts %q[\a\b\c\]"> -e:1: unterminated string meets end of file>> F:\>>> It seems to me the last \ shouldn't need to be escaped as \\, though that> does work. What's up? %q[foo] is equivalent to the single-quoted string literal 'foo'. Inthe same way, the only escapable characters are backslash and thecharacter that ends the literal: 'Mark\'s string'%q[square (\]) bracket] A literal backslash in a single quoted string only needs to be escapedwhere it might be confused as escaping the final quoting character,like in your example. HTH,Mark