I am missing something in this snippet... it claims every label only has a single record and then deletes it. I know however that there are SOME duplicates in the list of tapes after looking through it carefully. Did I construct my HoA wrong ... need outside viewpoint ... looking too long at the code any help appreciated.
209 sub hash_tapes (@) { 210 211 my @tapes = @_; 212 my %Tape_Cat =(); 213 214 foreach my $tape (@tapes) { 215 my ( $label, $protection, $location, $pool ) = @{$tape +}; 216 push @{ $Tape_Cat{$label} }, [ $protection, $location, + $pool ]; 217 } 218 219 # Get rid of non-duplicates 220 my $count = 0; 221 foreach my $tape (@tapes) { 222 my ($label,$protection,$location,$pool) = @{$tape}; 223 if ( @{$Tape_Cat{ $label}} < 2 ) { 224 print "Deleting ". $label. 225 "Because it has ".@{$Tape_Cat{ $label }}. 226 " record(s)\n"; 227 $count++; 228 delete $Tape_Cat{$label} 229 } 230 } 231 232 my @keys = keys %Tape_Cat; 233 print "Deleted $count keys, keys: @keys\n"; 234 return \%Tape_Cat; 235 }

In reply to Hmmm... HoA help ... by talwyn

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.