DATA.pos different, but why?

This program behaves differently when piped to ruby and when redirected
to ruby. Is this something I don’t understand about unix, something I
don’t understand about ruby, or a bug?

======t.rb========
p $0
p DATA.pos
END
this is some data.

···

==================

$ cat t.rb | ruby
"-"
-1
$ ruby <t.rb
"-"
24

Hi,

···

At Sun, 25 Aug 2002 16:30:10 +0900, Joel VanderWerf wrote:

This program behaves differently when piped to ruby and when
redirected to ruby. Is this something I don’t understand about unix,
something I don’t understand about ruby, or a bug?

Seek is nonsense for pipe.


Nobu Nakada