Very Carefully.
If you have both instances running on the same machine at the same time, take a look a using a tied-hash (particularly if there are more than one variable involved).
If you have successive executions, then you can read and write the state to a configuration file. (See CPAN for your choices here.)
If you have instances running at the same time on different machines, the co-ordination problem gets tougher. Sockets will come into play and a lot of work to verify that your 'global variables' really are in sync across the Network.
If the globals are read-only, I'd be tempted to design a forked master/worker solution, where the globals are set by the master, possible by reading a state-file, before forking off a worker task to complete the process.
Which ever way you choose, there will be issues of synchrony and update consistancy that you will have to address.
----
I Go Back to Sleep, Now.
OGB
|