in reply to Menu system uses the "calling stack"

Your menu() function has a loop.

I would call the entries inside and not after the loop.

The entries have to explicitly return after being done, not calling the menu() again.

If you want a menu for another level call menu() explicitly, like that your sub-menu is in the next call stack.

FWIW, if you really need this flow but without littering the call stack, you might also use the goto &NAME feature in perl after pushing the arguments onto @_ .

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery