From: "Marcel Molina Jr." Date: 2006-06-12T03:36:49+09:00 Subject: Re: gets problem - strange On Mon, Jun 12, 2006 at 03:21:18AM +0900, Jim Freeze wrote: > This is a problem that was pointed out by Esteban Velazquez. > > % cat gets2.rb > #!/usr/bin/ruby > > print "getting "; puts gets > > Sending the app arguments returns an error: > > % ruby gets2.rb fred > gets2.rb:3:in `gets': No such file or directory - fred > (Errno::ENOENT) > from gets2.rb:3 > > But, with no arguments, it runs ok. > > % ruby gets2.rb > getting foo > foo > > The problem is eluding me now. Any help would be appreciated. It works like perl in this regard, expecting the arguments on the command line to be files the lines of which you want read. % echo -e "foo\nbar" > some_file % echo "while l = gets; p l end" > gets.rb % ruby gets.rb some_file "foo\n" "bar\n" marcel -- Marcel Molina Jr.