I don't see the need for @nobody and the oldreports() and newreports() subs. Their function seems to ensure that each value in the %old and %new hashes will be array refs. Well, they are. :) If a leader has no reps, then use an empty anonymous array reference:my %old_lookup; for my $leader (keys %old) { $old_lookup{$_} = $leader for @{ $old{$leader} }; }
That way, the for loop that tries to iterate over the value will gracefully not.Bill => [],
After you build the lookup table, you can easily populate %needtomeet like so:
Happy coding, and here's to keeping the PHB at bay. :)for my $newtl (sort keys %new) { my %needtomeet; for my $rep (@{ $new{$newtl} }) { my $oldtl = $old_lookup{$rep}; push @{$needtomeet{$oldtl}},$rep if $oldtl; yadda yadda ...
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to (jeffa) Re: Restructuring Teams with Perl
by jeffa
in thread Restructuring Teams with Perl
by EdwardG
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |