From: Zach Dennis Date: 2005-02-08T03:21:36+09:00 Subject: Re: delayed string interpolation Navindra Umanee wrote: > Bill Kelly wrote: > >>I'm guessing I got into the habit early on to remind >>myself that ruby lets you specify single-quote semantics >>if you want them, like: >> >>x = <<'ENDTEXT' >>now things like \n are literal >>as they would be in 'single quote' strings >>ENDTEXT > > > Oh, hmph. I didn't even know that. It's not really documented is it? > > I didn't even realise \n would be converted to a newline in heredoc as > well. Going to have to be really really careful about things like > user-input, I guess. > > Thanks for the useful information. :) \n will only be converted it you allow string expansion, #a bunch of blank lines x = <<"ENDTEXT" \n\n\n\n\n ENDTEXT #a bunch of literal \n 's x = <<'ENDTEXT' \n\n\n\n\n ENDTEXT Note the double-quotes compared to the single quotes. Zach