Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Reading in parameters

by basicdez (Pilgrim)
on Mar 13, 2002 at 12:52 UTC ( #151359=perlquestion: print w/replies, xml ) Need Help??

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.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2022-01-22 00:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (60 votes). Check out past polls.

    Notices?