Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Passing and recieving params

by socketdave (Curate)
on Jul 15, 2005 at 16:09 UTC ( [id://475273]=note: print w/replies, xml ) Need Help??


in reply to Passing and recieving params

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 @_

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://475273]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-24 02:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found