|laziness, impatience, and hubris|
Answer: How do you use command line parameters?by DigitalKitty (Parson)
|on Aug 05, 2002 at 23:39 UTC||Need Help??|
The easiest way is to use the Getopt::Std module ( it is part of the standard distribution ). Here is a sample program.
Each command-line switch is assigned to its respective scalar variable ( $opt_s, etc. ) and if it exists, its individual value is 1.
You can also use multiple switches:
In the last example, I hadn't declared an $opt_c in the line 'use vars qw ( $opt_s ... );' or an if() statement to handle it. This is why I received the message.
Hope this helps,