> perl myscript.pl "data1" "data2 "data3"
>
> (a) is it possible to pass data arguments via the command line in this
way?

Yes, indeed.  Anything that is passed to your program in this way will be
stored in the array, @ARGV.  You can access the first argument with
$ARGV[0], the second with $ARGV[1], and so on.

> (b) inside the script I want to assign them to variables -- but how do I
> reference them? Do they count as being on STDIN or something?

You can assign them at the beginning of your script usign the following:

my @theArguments = @ARGV   #all of them in an array

-or-

my ($username, $password, $logfile, $filename) = @ARGV
     # Expect 4 arguments
     # Ignore the rest for now


Reply via email to