in reply to variable passing....

...and this may not even be the first homework question asked by lelak.

If you have two programs that you need to communicate between, you need to use the IPC version of open, or backticks (look for the qx// item in perlop).

In many cases like this, where you have two scrips needing to do (in part) the same task, it's usually easier to separate out the common task into a module, and call the module from both scripts. In a pinch, use open or `backticks` and just parse the output returned by the 2nd script.