From: Takeshi Horinouchi Date: 2003-09-02T18:16:37+09:00 Subject: [ruby-list:38336] bug? ($. in Ruby 1.8.0) 堀之内と申します。 以下のように Ruby 1.8.0 で組み込み変数 $.(行番号)の挙動が不審な のですが、仕様でしょうか、バグでしょうか。 % cat numbering.rb while(line=gets) print $.,': ',line end % ruby --version ruby 1.8.0 (2003-08-04) [i686-linux] % cat tmp test test test test test % ruby numbering.rb tmp 1: test 1: test 2: test 3: test 4: test 変だなと思うのは、行番号が 1,1,2,3,.. となり、1 が繰り返されてい ることです。これを Ruby 1.6.8 で実行すると、私の期待通り 1,2,3,... となります。 % ruby --version ruby 1.6.8 (2002-12-24) [sparc-solaris2.6] % ruby numbering.rb tmp 1: test 2: test 3: test 4: test 5: test よろしくお願いします。