Hi wrboyce.

Storing your DVD information in an XML file would be perfectly fine but if you were / are considering another avenue of exploration, I would suggest a hash of hashes ( HoH ).

#!/usr/bin/perl -w use strict; %DVDs = ( 'Reservoir Dogs: Special Edition' => { 'EAN' => '060049145457', 'director'=> 'Quentin Tarantino', 'year' => '1992', 'region' => 2, 'encoding' => 'PAL', 'aspect ' => '16:9', 'anamorphic' => 0, 'widescreen' => 1, 'audio' => 'Dolby Digital 5.1', 'length' => 94, 'cert' => 18, 'rating' => 5, }, 'C programmers: A documentary' => { 'EAN' => '060049189573', 'director'=> 'Ken Thompson', 'year' => '1996', 'region' => 2, 'encoding' => 'PAL', 'aspect ' => '18:2', 'anamorphic' => 1, 'widescreen' => 1, 'audio' => 'Dolby Digital 5.1', 'length' => 122, 'cert' => 16, 'rating' => 4, }, 'The History of Pascal' => { 'EAN' => '060054789573', 'director'=> 'Niklaus Wirth', 'year' => '1996', 'region' => 2, 'encoding' => 'PAL', 'aspect ' => '16:2', 'anamorphic' => 1, 'widescreen' => 1, 'audio' => 'Dolby Digital 5.1', 'length' => 175, 'cert' => 16, 'rating' => 4, }, );

Since perl permits 'autovivication', creating new key / value pairs is exceptionally easy. Should my idea of using a HoH not appeal to you, I don't see where using your current solution could be deemed a hindrance. If your project required storing a large quantity of data, you might consider using an RDBMS (Relational Database Management System) such as PostgreSQL or MySQL (either of which has distinct advantages and disadvantages). I don't have any experience using postgresql (yet) but I can recommend a good book for learning MySQL:

as well as a useful site for related tutorials:

Hope this helps,
~Katie

In reply to Re: DVD Profiler... by DigitalKitty
in thread DVD Profiler... by wrboyce

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.