From: Brian Candler Date: 2008-10-07T02:06:38+09:00 Subject: Re: Printing varible with quotes around it Jack Smith wrote: > I have tried > > puts %Q!z! > and > puts '"#{z}"' #{...} is only interpolated inside double-quoted strings. So you need: puts "\"#{z}\"" (where the double-quotes inside the double-quotes need to be escaped with a backslash), or puts %Q{"#{z}"} (where they do not) Or as others have said, puts z.inspect will show your string with double quotes around (but it will also perform additional transformations, such as turning " to \" and showing control characters in their escaped form, like \n for newline) -- Posted via http://www.ruby-forum.com/.