Home >> perldatatypes >>@ARGV and %ENVThe built-in array @ARGV contains the command line arguments for a Perl program. The following run of the Perl program critic.pl will have the ARGV array ("-poetry", "poem.txt"). unix% perl critic.pl -poetry poem.txt%ENV contains the environment variables of the context that launched the Perl program. @ARGV and %ENV make the most sense in a Unix environment. So for example you have a script like test.pl #!/usr/bin/perl use strict; my $column=$ARGV[0]; my $database=$ARGV[1]; ------run the program now--- $./test.pl ssn employeesin above example we are passing two values as commandline arguments. so $column will have "ssn" and $database will have "employees". Note: Pass values in quoutes if values have spaces. Perl functions
|
Perl Arrays Perl Data Types Perl Hash Perl list Perl references Perl Scalar data types Perl Special Variables
|