http://qs321.pair.com?node_id=151359

basicdez has asked for the wisdom of the Perl Monks concerning the following question:

Okay I am now passing my needed parameters with a system call, but how do I pick them up on the other end. With what I have here, I am getting nothing passed into test.pl!

Here is the line I am trying, but it is not working...

my ( $arg1 , $arg2, $arg3 ) = @_; #To read parameters system ("test.pl $number $name $type"); #To send them
Please help me if you can? </code>

Replies are listed 'Best First'.
Re: Reading in parameters
by derby (Abbot) on Mar 13, 2002 at 12:55 UTC
    basicdez,

    That was answered in the original thread.

    my( $arg1, $arg2, $arg3 ) = @ARGV

    You don't really need to assign to argX, perl automatically places the command line args in the @ARGV array for you.

    -derby

Re: Reading in parameters
by ChOas (Curate) on Mar 13, 2002 at 12:58 UTC
    Hi!

    In test.pl use the following:
    my ( $arg1 , $arg2, $arg3 )=@ARGV;
    And they should magically appear, and be usable, in test.pl

    And might I advice you to use:
    system (test.pl,$number,$name,$type);
    If you`re not gonna use the shell, just do it for safety`s sake...

    Hope this helps!

    GreetZ!,
      ChOas

    print "profeth still\n" if /bird|devil/;
Re: Reading in parameters
by PrimeLord (Pilgrim) on Mar 13, 2002 at 14:57 UTC
    In the spirit of TIMTOWTDI you could always look at Getopt::Std. It would give you a little more flexibilty with your arguments.