You won't see the repeated items, like major, since the hash will only hold the last value.
$ perl -d Default die handler restored. Loading DB routines from perl5db.pl version 1.07 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. $students{"Mary Pitts"}=( { "year"=>"4", "GPA"=>"4", "major"=>"Economics", "major"=>"Economics", "email"=>"mpitts\@school.edu" } ); print "Mike was here..."; main::(-:1): $students{"Mary Pitts"}=( main::(-:2): { main::(-:3): "year"=>"4", main::(-:4): "GPA"=>"4", main::(-:5): "major"=>"Economics", main::(-:6): "major"=>"Economics", main::(-:7): "email"=>"mpitts\@school.edu" DB<1> n main::(-:11): print "Mike was here..."; DB<1> x %students 0 'Mary Pitts' 1 HASH(0xa038a8c) 'GPA' => 4 'email' => 'mpitts@school.edu' 'major' => 'Economics' 'year' => 4
See? Only one major...

Are you saying you want an error to occur when a duplicate value is attempted? A large debate occurred on p5p recently (a few months ago) about clamped hashes, but I don't remember what the outcome was, or whether the feature will be in 5.8.
--
Mike


In reply to Re: Re: Delete repeated Hash's / HOH's by RMGir
in thread Delete repeated Hash's / HOH's by juve

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.