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"; }