@ARGV contains a list of command line arguments that the user included when invoking your script.
Getopt::Long is the core module most commonly (and wisely) used for handling command line arguments.
The <> IO operator (see perlop), known as the "null filehandle" allows your script to take input either from STDIN, or from the list of files the user enumerated on the command line while invoking your script. Internally it gets this information from @ARGV.
And then there's always command line indirection.
For example, if you have a script designed to read from STDIN, you could instead invoke it with command line indirection like this:
myscript.pl <filename.txt
That method also works for output. If you want your script to print to a file instead of to the screen, you can type:
myscript.pl >outfile.txt
Those last two examples are operating system dependant, so you'll need to check your OS's documentation to gain info on specifics.
Hope this helps...
Dave
In reply to Re: how to access the commandline arguments?
by davido
in thread how to access the commandline arguments?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |