From: "ara.t.howard" Date: 2008-08-22T00:42:07+09:00 Subject: Re: possible simple marshall error On Aug 21, 2008, at 9:34 AM, Lex Williams wrote: > I recently tried to learn to use Marshal with a simple script , but I > keep getting the following exception : x.rb:6:in `load': marshal data > too short (ArgumentError) > > This is the script : > > hsh = {:first => [1,2,3],:second => [4,5,6] } > > File.open("saved.m","w").puts(Marshal.dump(hsh)) > > str = (File.open("saved.m").read) > hix = Marshal.load(str) # this appears to be the problem line > hix.each_key do |key| > puts "key : #{key}" > end > > could anyone tell me what I'm doing wrong ? > -- you are probably on windows and have forgotten to open the file in binary mode. also, you are re-writing the built-in pstore class, so you might want to just use that - or at least read over it. regards. a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama