On 21.09.2009 18:05, Ne Scripter wrote: > I have a question, I want to store some data in two columns, for example > > 0001, stuff1 stuff2 > 0002, morestuff > 0003, extrastuff > 0004, more evenmore > > As you can see column 1 is an ID and column 2 is one or more strings. > > I want to do a search across another data set to say if column 1 (ID > number) matches in both sets and the contents of column 2 to data set B. > > I initially thought to use a hash, but it scrambles the order of the > data so was unsure of its efficiency and use. > > Any suggestions? I think you got some useful recommendations yet. I still have some doubts whether I understand your requirements properly. If you want to determine whether set B is a subset of A you can also do something like this: require 'set' YourData = Struct.new :id, :text set_a = File.readlines("a.dat"). map {|l| l.chomp!; YourData.new(*line.split(/,/, 2)}. to_set set_b = File.readlines("b.dat"). map {|l| l.chomp!; YourData.new(*line.split(/,/, 2)}. to_set if set_a.superset? set_b puts "all b are there" end Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/