in reply to Re: package variable does not persist
in thread package variable does not persist

Thank you all for asking the right questions about my somewhat wrongly sought wisdom, sorry about that. AnomalousMonk answered Corion's question for me and this good advice was being followed too: "Just the exercise of preparing the SSCCE may reveal to you the root cause of the problem." and it worked of course. I now understand the problem so the solution is obvious. I knew it was some dumb mistake.

One thing the use Module line does is check for params and dispatches subs based on them which eventually terminate the process.

If there are no params the use Module line does no dispatch and the script proceeds to set the package var and call a sub that sees it and all is well.

If there are params then nothing in the script happens after the use Module line, like setting the package variable, and that was the confusing part.

Since the use line is indeed hijacking my flow as AnomalousMonk noticed, haukex suggested setting the var in a BEGIN block, and now that I understand the problem it all makes sense and works as expected. Thank you monks!