Hi!

I've tried to write a little program, which detect duplicate files.
My way to solve this is to have a hash for the known files like this
{ fileSize  => [[file1,file2],[file3,file4]],
  fileSize2 => [[file6,file7]] }

So, file1..file4 have the same size, file1 and file2's content is
identical, similarly file3 and file4 is identical.

First, the Hash is empty, and then I insert the files to be examined,
like this.

files = Hash.new { [] }
for filename in filesToBeAdded
  filesize=File.filesize(filename)
  for fn in filename[filesize]
    if equalContent(fn[0], filename)
      # add this file to this 'segment' TODO: alter files
      # next 'filename in filesToBeAdded'
    end
  end
  # if loop exited normally, create a new segment
end

So questions in general:
How can I alter items in a hash nicely?
Can I exit more loops with next/last/redo? (like in perl)
Is there something similar to python's for .. else ... structure? (Do
something, ONLY when the loop is terminated normally (without break)

thx
Gergo
-- 
+-[ Kontra, Gergely<kgergely / mcl.hu> PhD student Room IB113 ]---------+
| http://www.mcl.hu/~kgergely            "Olyan langesz vagyok, hogy  |
| Mobil:(+36 20) 356 9656 ICQ: 175564914   poroltoval kellene jarnom" |
+-- Magyar php mirror es magyar php dokumentacio: http://hu.php.net --+