From: Mark Hubbart Date: 2004-03-18T02:44:45+09:00 Subject: Re: why use heredoc in doublequotes? On Mar 17, 2004, at 9:14 AM, Simon Strandgaard wrote: > On Wed, 17 Mar 2004 09:18:30 -0700, Ara.T.Howard wrote: > [snip] >> ~/eg/ruby > cat heredoc.rb >> s = 'foobar' >> >> p <<"<<" >> #{ s } >> << >> >> ~/eg/ruby > ruby heredoc.rb >> " foobar\n" >> > > I bet this can be useful for making an obscure compact quine. > > ;-) Since Ruby doesn't care what you use as delimiters, usually... >> %q delimited_with_spaces .inspect.display "delimited_with_spaces"=>nil >> %q delimited with plain 'ol tabs .inspect.display "delimited with plain 'ol tabs"=>nil >> %q ?> and with newlines?!? ?> .inspect.display "and with newlines?!?"=>nil >>%q^Hbackspaces are stranger yet^H.inspect.display "backspaces are stranger yet"=>nil >>%q^CBut the interrupt character really takes the cake^C.inspect.display "But the interrupt character really takes the cake"=>nil I beg you, though -- *please* don't take advantage of the fact that you can delimit strings with interrupts!!! ;) --Mark