From: "David A. Black" Date: 2009-09-08T20:46:39+09:00 Subject: Re: different results with File.exists? Hi -- On Tue, 8 Sep 2009, Mehdi Karamnejad wrote: > when I use a string constant with File.exists? like the following ,it > works fine: > File.exists?("/home/sepehr") > but when I get the string from user: > path=gets > if File.exists?(path) then > ---- > ---- > end > it doesn't work! what's wrong with the string which is typed by the > user? It ends with a newline. Try path.chomp. David -- David A. Black / Ruby Power and Light, LLC / http://www.rubypal.com Ruby/Rails training, mentoring, consulting, code-review Latest book: The Well-Grounded Rubyist (http://www.manning.com/black2) September Ruby training in NJ has been POSTPONED. Details to follow.