T
Thomas Greenwood
There's probably a fairly simple way to do this.
Basically I'm reading data from an xml file, I need to figure out how
many times identical data occurs in certain attributes, so far I've got
the data into two identical arrays and had the intention of nesting
iterators - seeing if the element was equal to the second and
incrementing every time a match was found. That obviously didn't work
out the way I initially thought.
This seems to be the jist of what I want but it's obviously returning a
count on every iteraton whereas I only want the final tally.
xml_events.each{|x|
puts "#{x} occurs #{xml_events.count(x)} times"
}
Any ideas?
Basically I'm reading data from an xml file, I need to figure out how
many times identical data occurs in certain attributes, so far I've got
the data into two identical arrays and had the intention of nesting
iterators - seeing if the element was equal to the second and
incrementing every time a match was found. That obviously didn't work
out the way I initially thought.
This seems to be the jist of what I want but it's obviously returning a
count on every iteraton whereas I only want the final tally.
xml_events.each{|x|
puts "#{x} occurs #{xml_events.count(x)} times"
}
Any ideas?