You don't seem to be using @the_inputs for anything useful, and you throw away the returned value, at least in the internal recursive calls.
in reply to subroutine memory variable scope
Iterating over the inputs for a given recursion will take care of itself - I don't see a need to save the list for posterity.
I would suggest getting rid of it entirely, since you have shown no use for it.
"By three methods we may learn wisdom: First, by reflection, which is noblest; Second, by imitation, which is easiest; and third by experience, which is the bitterest."