2.2. Getopt::Long
- I needed a flexible command line processing, so I looked at Getopt::Long.
- Here's my code snippet:
# This is a flag that specifies whether to present the moves in Run-Length
# Encoding.
my $to_rle = 1;
my $output_states = 0;
my $scan = "brfs";
my $run_time_states_display = 0;
#my $p = Getopt::Long::Parser->new();
if (! GetOptions('rle!' => \$to_rle,
'output-states!' => \$output_states,
'method=s' => \$scan,
'rtd!' => \$run_time_states_display,
))
{
die "Incorrect options passed!\n"
} |
!options are boolean. (specified with--rleand--norle)=soptions accept a string argument.pass_throughconfiguration option - process the known arguments and leave the others alone - used for determining the game variant.