in reply to keeping something in memory after the end of script
If the "Next run" is started from the same shell, or a child of that shell, you could use "export"ed environment variables to persist data, as suggested here.
This is not an optical illusion, it just looks like one.
In Section
Seekers of Perl Wisdom