in reply to Perl Script Calling Another Perl Script

You might want to look into open(FH, '-|'). Then you could require program2 in the child block, and it would have access to all the variables, in addition to being able to write to the parent via STDOUT.

Alternatively, you might want something like

$gimme = `perl prog2 $var1 $var2`
where prog2 will print (to STDOUT) whatever you want $gimme to get back from it.

Replies are listed 'Best First'.
Re: Re: Perl Script Calling Another Perl Script
by mcogan1966 (Monk) on Nov 20, 2003 at 20:43 UTC
    Yeah, that is the answer that basically fell on my head just minutes after making my post. Though my variant encloses $var1 and $var2 in double quotes. The reason for that is if either of them contain any spaces, the backtick will parse out the spaces as a break between arguments being passed, and I don't want that to happen.