If your keysvalues look duplicate, most likely, there are things you don't see. Most likely it's whitespace at the end of one keyvalue. Inspect your hash through Data::Dumper, and best concentrate on keysvalue that should be equal but aren't:

use strict; use Data::Dumper; my %hash = ( 'Hello ' => 'world', 'The' => 'world ', ); print Dumper \%hash;

If your hash is too large to conveniently dump, you can find out one of the values that are duplicate and create a copy of the hash:

for (keys %bad_hash) { if ($bad_hash{$_} =~ /orl/) { # because we're looking for "hello" $hash{ $_ } = $bad_hash{ $_ } } } print Dumper \%bad_hash;

You also might run into encoding issues where two different octet sequences (that actually compare as unequal) encode to the same glyph sequence. But as Perl 5.8 internally uses UTF-8, that shouldn't be a problem. In any case, it would help to see some more yet still small code and some really small dataset (2 lines) that reproduces the problem.

Update: Realized this is about values, not keys.


In reply to Re: remove duplicates by Corion
in thread remove duplicates by Anonymous Monk

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.