Local and Global Variables
Any simple variables that you create, or any changes you make to existing variables, will only persist while the template is being processed. The top-level variable hash is copied before processing begins and any changes to variables are made in this copy, leaving the original intact. The same thing happens when you INCLUDE another template.
So you can't do that as-is, but you could subclass Template::Stash or pull other similar dirty tricks :)