From: newbie Date: 2006-05-25T00:41:32+09:00 Subject: disappearing hash values? mailbox = File.open(mbox) mailbox.each_line {|line| linecount += 1 mboxArray.push line if line.include?("filename=") haveattach = TRUE filename = line.gsub("Content-Disposition: attac hment;", '') filename = filename.gsub("filename=", '') filename = filename.gsub(/"/, '') filename = filename.gsub(/^ /, '') filename = filename.chomp + ".b64" filehash = {filename => linecount-2} print "filehash[filename] is: " + filehash[filen ame].to_s + "\n" #prints 183 the first time through the file end if ( line.include?("--(null)") && haveattach ) print "filehash[filename] is: " + filehash[filen ame].to_s + "\n" #this is now nil for some reason print "linecount is: " + linecount.to_s + "\n" length = linecount-filehash[filename] filehash = {filename => length} haveattach = FALSE end } why does the value of filehash[filename] disappear in the second "if"? -- Posted via http://www.ruby-forum.com/.