From: Lex Williams Date: 2008-08-22T00:52:32+09:00 Subject: Re: possible simple marshall error Michael Libby wrote: > On Thu, Aug 21, 2008 at 10: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)) > > This line is actually the problem from what I can tell. > > Try instead: > > File.open("saved.m", "w"){|f| f.puts(Marshal.dump(hsh)) } > Thanks Michael , that was the problem indeed . But , what is the difference between those two language constructs ? -- Posted via http://www.ruby-forum.com/.