From: ga rg Date: 2008-05-30T00:24:38+09:00 Subject: Silly issue with if / else with pingecho I'm positive that this is something incredibly silly. I have a text file with computer names. I'm assuming that if a computer returns a ping then it exists. To check this I have the following in a script: def computer_exists?(computername) Ping.pingecho(computername) end file = File.new(FILENAME, "r") while (line_item = file.gets) line_item = line_item.gsub(/\s+$/, $/) #remove trailing white space puts "Working on #{line_item}" if computer_exists?(line_item) deploy(line_item) else puts "Timed out" end end file.close The file contains three computer items: ComputerA ComputerB ComputerC When I go to irb and I do Ping.pingecho('ComputerA') it turns it as true. All three computer exist and are pingable. However, when I run the above code, ruby outputs Computer A and Computer B as Timed out but Computer C runs the deploy method. If I add a ComputerD, then ComputerA,B,C say time out and only Computer D runs the deploy method. What have a messed up? Thank you. -- Posted via http://www.ruby-forum.com/.