Hello,

Further to my recent node 474948 i have a question relating to flattened hashes and arrays.

When an array or hash is passed to a subroutine or function it is flattened and so if it is passed as (@, $) and recieved as (@, $) the $ will have no value.

Is this the same with passing to an external script using the exec function.

At the moment i am doing this:

exec = ("BlastTool.cgi", "$date", "$show_filter", "$oldRefFile", "$blast_filehandle", "$ref_filehandle", "$email", "$send_email","$show_all", "\@OrigRef", "\@blastLine", "\@species_filter", "\@chromo_filter", "\@advanced_filter") or die;

In script one, then passing to script 2

my $date = shift @_; my $show_filter = shift @_; my $oldRefFile = shift @_; my $blast_filehandle = shift @_; my $ref_filehandle = shift @_; my $email = shift @_; my $send_email = shift @_; my $show_all = shift @_; my @OrigRef = @{shift @_}; my @blastLine = @{shift @_}; my @species_filter = @{shift @_}; my @chromo_filter = @{shift @_}; my @advanced_filter = @{shift @_};
Is this right or am i way off here.
I have had a look at this node which is asking the same thing but there is no reference to arrays or hashes with using system.

I have also noticed that i have left out the @args at the end of the exec function: exec("program", "params", @args);
Does this matter.

cheers.


In reply to 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.