Logan Capaldo
7/12/2006 5:12:00 AM
On Jul 12, 2006, at 12:30 AM, Minkoo Seo wrote:
> I should have to mention this problem explicitly.
>
> AFAIK, $/ is 'input record separator' while $\ is 'output record
> separator.'
> And the problem is:
>
> $ruby -e 'p "a"'
> "a"
> $
>
> As you can see p is printing new line character. But the spec says
> that
> p is supposed to print 'output record separator' after printing out
> given
> arguments.
>
> Let's see what current output record separator is...
>
> $ruby -e 'p $\'
> nil
> $
>
> Surprisingly, $\, output record separator, is nil while Kernel#p
> printed new
> line.
>
> So I guess one of the following holds:
> (1) p prints new line instead of output record separator.
> (2) Somehow, $\ is converted into newline while Kernel#p is running
> (3) $\ is not a output record separator, actually.
>
> Any idea?
>
> - Minkoo Seo
>
>
>
Ack, top posting evil.
$\ is the output record separator if print is any indicator
% cat outputsep.rb
$\ = ":"
print 1
puts
% ruby outputsep.rb
1:
I think maybe the docs lie. Looking at the C code, p uses
rb_default_rs (when maybe they meant to use rb_output_rs?)