"Matthew Margolis" <mrmargolis / wisc.edu> schrieb im Newsbeitrag
news:41119195.7010502 / wisc.edu...
> I am trying to figure out how to open up a text file in a subdirectory
> of my programs main directory.  The file I want is in the subdirectory
> labeled text.  I get a "Permission  denied - text/" message when
> attempting to run the code found below.
>
> campershash = Hash.new
> Dir.entries("text").each do |textfilename|
>    campershash["#{textfilename.chop.chop.chop.chop}"] =
> File.open("text/" + "#{textfilename}") { |f| f.gets(nil) }
> end

campershash = {}

Dir.entries("text").each do |textfilename|
   key = textfilename[0...-4] and
     campershash[key] = File.read( File.join("text", textfilename) )
end

    robert