From: Mike Stok Date: 2006-05-20T00:59:44+09:00 Subject: Re: problems with irb? str = 'a\b\c' seems impossible On 19-May-06, at 11:53 AM, dblack@wobblini.net wrote: > Hi -- > > On Sat, 20 May 2006, Krekna Mektek wrote: > >> Can someone help me out with this, I can't put the string 'a\b\c' in >> the variable str, which is strange, because I am working with the >> PickAxe book, and this what should work (page 71, 2nd ed.) >> >> the two before seem to work, but the example in the book, 'a\b\c' >> seems not. >> This a bug? How come irb does not seem to understand the last quote? >> >> irb(main):021:0> str = 'a\b\c ' >> => "a\\b\\c " >> irb(main):022:0> str = 'a\bc' >> => "a\\bc" >> irb(main):023:0> str = 'a\b\c' >> irb(main):024:0' >> irb(main):025:0' ' >> SyntaxError: compile error >> (irb):25: unterminated string meets end of file >> from (irb):25 >> from :0 > > I've noticed that too. For some reason, '\c' seems to produce > something other than a literal backslash-c sequence. I stumbled on > that a month or so ago but I don't know why it happens. > > (Helpful answer, isn't it? :-) Idle speculation here. It looks like something is getting confused, in double quoted strings \c is the beginning of a control sequence irb(main):004:0> "\cX" => "\030" and that may be mis-handled by irb? Mike -- Mike Stok http://www.stok.ca/~mike/ The "`Stok' disclaimers" apply.