Perl: the Markov chain saw | |
PerlMonks |
Re: Passing and recieving paramsby socketdave (Curate) |
on Jul 15, 2005 at 16:09 UTC ( [id://475273]=note: print w/replies, xml ) | Need Help?? |
When you do an exec() or system() it's just as if you've typed the command on the command line and are passing arguments to it. Figure out how you would call the second script from the command line and emulate that format with exec() or system(). I also think that your understanding of passing an array to a sub may be a bit off. Whatever you pass to a sub is available as @_ inside the sub. It has indeed been flattened, but if you structure your arguments properly this isn't a problem. If you send it (@,$), then you effectively have the original array with the scalar on the end. To get it back you can just do $my_scalar = pop @_ and then @_ should be identical to the array that you passed. UPDATE: I also notice that you're using shift @_ in your second script... Remember that the second script is being called from the command line, so your parameters are in @ARGV, not in @_
In Section
Seekers of Perl Wisdom
|
|