From: Thomas Hurst Date: 2002-02-27T00:56:07+09:00 Subject: Re: Trouble with opening files * Chris Gehlker (gehlker@fastq.com) wrote: > I just can't wrap my head around why this little program doesn't work: > #!/usr/bin/env ruby > $stdout.sync= true > File.open("~/ruby/sample/testFile", "r") ~ is a shell globbing operator, it has no meaning outside /bin/sh. Use ENV['HOME'] + "/ruby/sample/testFile" or, um, I'm sure I saw a function to expand shell globs somewhere.. maybe Dir#glob or something. > a = testFile.gets > puts a You're opening a file here but then not doing anything with it; where is testFile from? you want: File.open(ENV['HOME'] + "/ruby/sample/testFile", "r") do |testFile| .. end -- Thomas 'Freaky' Hurst - freaky@aagh.net - http://www.aagh.net/ - You ain't learning nothing when you're talking.