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--rle
and--norle
)=s
options accept a string argument.pass_through
configuration option - process the known arguments and leave the others alone - used for determining the game variant.