From: "Eric I." Date: 2008-09-25T01:34:55+09:00 Subject: Re: Strange ruby problem On Sep 24, 10:18 am, "christofore...@gmail.com" wrote: > So i've cut the program down to about 4 lines to give the idea of > whats going on: > > num = ARGV[0] > num2 = ARGV[1] > puts " #{num} #{num2} \n" > line = gets > > if i give the program some input from the command line it fails and > sais " gets: No such file or directory -1" > yet if i supply no input the program goes straight to gets. This seems > fairly strange to me. Though when I did this: > > num = ARGV[0] > num2 = ARGV[1] > puts " #{num} #{num2} \n" > STDOUT.flush > line = STDIN.gets > > everything works normal. Why is this and whats going on? Thanks in > advance I think we need to see your command-line arguments and whether you're putting them before the name of the Ruby script or after. Are you invoking the script like: ruby script.rb arg1 arg2 or: ruby arg1 arg2 script.rb because the first is what you should be doing. Alternatively, do you have RUBYOPT set or do you invoke any arguments on your #! line (if you're on a Unix-like system). Eric ==== LearnRuby.com offers Rails & Ruby hands-on public & on-site workshops. Ruby Fundamentals Workshop Oct 8-10 Ann Arbor, Mich. (Note: Great Lakes Ruby Bash in Ann Arbor on Oct. 11; attend both!) Please visit http://LearnRuby.com for all the details.