$VAR1 = {
'4' => '3',
'1' => '1',
'3' => '2',
'2' => '1'
};
####
sub getreports {
my $target = shift(@_);
while (my ($employeeid, $bossid) = each %boss) {
print "scanning data for x, $target: $employeeid, $bossid\n";
if ($bossid eq $target) {
print "\n$bossid $name{$bossid} $area{$bossid}\n-> $employeeid $name{$employeeid}\n";
if ($hasreports{$employeeid}) {
print "$name{$employeeid} has subordinates\n";
print "getting employees of $employeeid\n";
getreports($employeeid);
}
}
}
print "exiting while % boss with target of $target\n\n";
}
####
scanning data for x, 2: 4, 3
scanning data for x, 2: 1, 1
scanning data for x, 2: 3, 2
2 big boss corner office
-> 3 small boss
small boss has subordinates
getting employees of 3
scanning data for x, 3: 2, 1
exiting while % boss with target of 3
scanning data for x, 2: 4, 3
scanning data for x, 2: 1, 1
scanning data for x, 2: 3, 2