>My question then, is how do you pass variables to perl script from the Unix
>command line and how are those variables processed within the script? More
>than likely, the variables will need to be passed to either an array or hash.

Well, there are two main ways I know of to pass vars to Perl from the command 
line.  The first is where the entire script is contained on the command line, 
affectionately known as a "one-liner".  The second uses an array called @ARGV, 
which takes arguments passed after perl scriptname, in order.  For example:

%perl yourscript filename someinteger

# $ARGV[0] contains filename
# $ARGV[1] contained someinteger

Within your script, for this example, you could access the vars as above, by 
index, or say something like

my $file = shift; #shifts off of @ARGV
my $int = shift; #shifts off of @ARGV again

There are also a couple of modules by the name of GetOpt::Std and GetOpt::Long 
that you may find very useful for parameter passing etc.

Regards,

Nathanael Kuipers


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to