On Feb 5, 3:52 am, Robert Klemme <shortcut... / googlemail.com> wrote:

> require 'set'
> addresses = Set.new
>
> File.foreach "data.txt" do |line|
>   line.chomp!
>   line.downcase!
>
>   puts "Duplicate: #{line}" unless addresses.add? line
> end

h = {}
File.foreach("data"){|e|
  e = e.strip.upcase
  puts "Duplicate: #{ e }"   if h.include? e
  h[ e ] = true
}