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 reply to Re: Passing and recieving params by socketdave
in thread Passing and recieving params by MonkPaul

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.