Compare 2 "arrays"

Hello,

sorry i’m a beginner with ruby and hanging on
a problem comparing two arrays?

Have anybody an advice what’s wrong in my logic, beacuse printing of k
and row2[“id”] like
p “#{k} = #{row2[“id”]}” works!?

many thanks ,Christian

rows=0
ngs=Array.new

some thousand id’s

FCSV.foreach("#{path}#{part1}",:headers =>true ,:col_sep => “\t”) do |
row|
ngs.push(row[“id”])
end

a lot of millions

FCSV.foreach("#{path}#{part2}",:headers =>true ,:col_sep => “\t”) do |
row2|
ngs.each do |k|
if k == row2[“id”]
p row2
end
end
end

mp_hash.rb:36: undefined local variable or method found' for main:Object (NameError) from cmp_hash.rb:34:ineach’
from cmp_hash.rb:34
from c:/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.2.0/lib/faster_csv.rb:
1429:in each' from c:/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.2.0/lib/faster_csv.rb: 990:inforeach’
from c:/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.2.0/lib/faster_csv.rb:
1162:in open' from c:/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.2.0/lib/faster_csv.rb: 989:inforeach’
from cmp_hash.rb:33

On 11/5/07, Christian [email protected] wrote:

mp_hash.rb:36: undefined local variable or method `found’ for

On line 36 of the source file mp_hash.rb is something called ‘found’,
but it is not defined.
The same happen with the follwing very short program:

test=found

ruby -w test.rb

test.rb:1: undefined local variable or method ‘found’ for main:Object
(NameError)

On 5 Nov., 21:33, [email protected] wrote:

test=found

ruby -w test.rb

test.rb:1: undefined local variable or method ‘found’ for main:Object
(NameError)

arrgh a classical example -
to not see the forest for the trees

thanks christian