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 }