Processing Command Line Options with PERL |
|
|
--- CODE #!/usr/bin/perl use Getopt::Long; # set default value for option $debug = 0; # get value of debug flag $result = GetOptions ("debug" => $debug); # print value print "Debug flag is $debug"; ---END CODE Now, try running this code as is: $ ./script.pl Debug flag is 0 And then try running it after adding a "--debug" command-line option: $ ./script.pl --debug Debug flag is 1 |
|
Powered by
KBPublisher (Knowledge base software)