On Feb 26, 2007, at 11:48 AM, James Edward Gray II wrote:

> If you can afford to read one of the files into memory because it's  
> not too large, you can probably speed that up quite a bit:
>
> require "set"
>
> allowed = Set.new
> FCSV.foreach(tdest) do |row|
>   allowed.add(row[scomp_args[0]..scomp_args[1]].join(" "))
> end
>
> passvalues = FCSV.open(fsource) do |source|
>   source.select do |row|
>     allowed.include? row[scomp_args[0]..scomp_args[1]].join(" ")
>   end
> end

The above destroys the field order.  If you need to keep the order,  
use an Array instead:

allowed = Array.new
FCSV.foreach(dtest) do |row|
   allowed << row[scomp_args[0]..scomp_args[1]].join(" ")
end

# ...

James Edward Gray II