Your use of the hash isn't very perlescent. You shouldn't be scanning it repeatedly. Every recursive call starts by scanning %boss, and hitting the same two ifs for the first item in it.
Give your algorithm some more thought. Maybe write it in pseudocode first.
The PerlMonk tr/// Advocate