Im not convinced that what you are doing is the correct way to your goal (which I am unsure exactly what that is).

I would have code handle all arguments via initial command line, then branch out depending on what needed to be done. If you needed to call a new module or script, do it via code, not via the command line.

Here is my crappy (super duper crappy wappy) possibility to your probable goal :
use strict; my $a_a_switch_param; my $a_b_switch_param; my $c_b_switch_param; my $b_a_switch_param; my $b_b_switch_param; for (my $argcnt=0;$argcnt<=$#ARGV;$argcnt++) { my $arg=$ARGV[$argcnt]; if($arg eq "-a") { $argcnt++; $a_a_switch_param=$ARGV[$argcnt]; }elsif($arg eq "-b") { $argcnt++; $a_b_switch_param=$ARGV[$argcnt]; }elsif($arg eq "-c") { $argcnt++; $a_c_switch_param=$ARGV[$argcnt]; }elsif($arg eq "-ba") { $argcnt++; $b_a_switch_param=$ARGV[$argcnt]; }elsif($arg eq "-bb") { $argcnt++; $b_b_switch_param=$ARGV[$argcnt]; } } my $b_prog_output=qx/perl b.pl $b_a_switch_param $b_b_switch_param/;

In reply to Re: pass command line parameters by kabeldag
in thread pass command line parameters by sombhotla

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.