In a quoted string, a \cx is an escape for ctrl-x, so the \c\] is
interpreted as ctrl-] as the \] is an escape for the bracket in the quoted
string.  Since there is no close bracket you get an error. 

Try this...
 
puts %q[\a\b\\c\\]

And you get

\a\b\c\

_Kevin

-----Original Message-----
From: Richard Lionheart [mailto:NoOne / Nowhere.net] 
Sent: Saturday, November 19, 2005 07:47 PM
To: ruby-talk ML
Subject: Trailing \ in %q[\a\b\c\] not treated as literal???

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?

--
TIA,
Richard