On Wed, Jan 15, 2003 at 02:31:22AM +0900, Kazuo Saito wrote: > [ruby-dev:19261] lstripped here-document > > Nobu Nakada proposed the idea for a new here-document style inspired by > [ruby-talk:50473]. In his idea, if you assign a character (except > quotes) after the here-document indicator "<<-", All blanks and > assigned character at the head of each line will be deleted. > Here is a example assigning '|': > > p <<-|EOS > | foo > | bar > EOS > # => " foo\n bar\n". > > He already posted a patch to add this function. Matz wants any > comments for the idea from all Rubyists. I like the idea of being able to indent my here documents. I'm not convinced that the proposed solution is the best solution, though. Note that the perl community has already given this problem much thought: http://dev.perl.org/rfc/162.html .From what I can gather, the proposed perl solution would look like this in Ruby: p <<<EOS foo bar EOS #=> " foo\n bar\n" (that is, strip any leading whitespace that is indented the same as the terminator). There's something to be said for using the same syntax as perl6, since it will make translation easier and reduce confusion. I think a similar argument was made for not including certain books from the Septuagint in the Christian Bible. Paul