Instead of de-duping after the fact you could make sure your lists are unique as you build them. Simpler and shorter.
use strict; use Data::Dumper; my $team; my $player; my %teamAccts; my %seen; while (<DATA>) { if (/^T:(\S+)/) { $team = $1; next; } if (/^P:(\S+)/) { $player = $1; push @{$teamAccts{$team}}, $player unless $seen{"$team$player"}++; } } print Dumper(\%teamAccts); __DATA__ T:REDS P:GRIFFEY P:GRIFFEY P:PEREZ P:ROSE P:BENCH T:PHILLIES P:ROSE P:ROSE T:MARINERS P:GRIFFEY P:PEREZ
In reply to Re: Unique Values within AOH
by hippo
in thread Unique Values within AOH
by dirtdog
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |