From: Joey Gibson Date: 2003-09-17T21:22:13+09:00 Subject: Re: [newbie]saving and reading array of associative array On 9/17/2003 6:34 AM, gabriele renzi wrote: >Marshal::dump > dump( anObject [, anIO] , limit=--1 ) -> anIO > >BTW you could even use PStore, included in the standard lib, it works >similar to an hash, but gets saved on disk and supports 'transactions' >for data integrity. > > You could also use YAML: require 'yaml' one = {"Name" => "Smith", "Surname" => "John"} two = {"Name" => "Dupont", "Surname" => "Jean"} myFriends = [one, two] File.open("myfriends.db", "w") {|file| file.write(myFriends.to_yaml)} myFriends = File.open("myfriends.db") {|file| YAML.load(file)} -- Dean saor, dean saor an spiorad. Is seinn d'orain beo. http://www.joeygibson.com http://www.joeygibson.com/blog/life/Wisdom.html