From: "Rebhan, Gilbert" Date: 2007-02-06T23:54:59+09:00 Subject: Re: Parse csv similar file Hi, -----Original Message----- From: Brian Candler [mailto:B.Candler@pobox.com] Sent: Tuesday, February 06, 2007 3:37 PM To: ruby-talk ML Subject: Re: Parse csv similar file > what kind of collection is the best ? is an array sufficient ? /* Depends what you want to do with it. If you want to be able to find an entry E123456 quickly, then you'd use a hash. If you want to keep only the first/last entry for a particular key (as it seems you do), using a hash speeds things up here too. */ i don't need to find all entries E..... , but collect all datas that belong to the different E..... i want a collection for every E... that occurs, with all the lines (except the E... itself) that contain that E in it /* Try: efas = Hash.new ... efas[$3] = [$1,$2,$4,$5,$6] unless efas.has_key?($3) ... puts efas.inspect */ that gives me only one dataset in the hash, but there are more entries that have E123456 in it. Regards, Gilbert