Hi smgfc,

I answer to your suggestion to you the full path to an mp3 as the hash key this is not a good idea. Think about a file system. Each file at a given location occurs once and only once, therefore if the path is equal so too is the file. You won't be able to find duplicate song residing in different locations like this.

My feeling is that you would be best to use a far purer key for the hashes. I suggest you create a first hash that contains just artist name, this maps to a second hash called song title, which maps to a third hash called track info (which can be used to store detail about the individual MP3 such as its location). What you are trying to build is a complex data structure so I would urge you to look at perlman:perldsc and perlman:perllol. I might even go so far as to say that creating an object to store in your hash might be a good idea to encapsulate data... perlman:perltoot and perlman:perlobj.

Of course any solution relies on good ID3 tags for files so some sort of handling routine for when these don't contain enough info will be necessary. I.e. extract and check the ID3 before placing into hash, don't do it on the fly. But then thats always the fun of trying to organise an MP3 collection.

As an aside the best tool I know for refactoring MP3 tags is Tag&Rename. Check it out... very handy.

Anyway, hope this helps.

____________
Arun

In reply to Re: Removing Duplicates from Hash of Hash of id3 information by arunhorne
in thread Removing Duplicates from Hash of Hash of id3 information by smgfc

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.