http://www.perlmonks.org?node_id=888735


in reply to Parsing options with Getopt & Dispatch Table

The following works with Getopt::Long

#!/usr/local/bin/perl # Argument options using Dispatch Tables use strict; use Getopt::Long; my $result = GetOptions ( # For each option, call appropriate su +broutine. "-h" => \&help, "-d" => sub {print "\nRun DEV COMPARE\n";}, "-p" => \&PROD, ); sub PROD {print "\nRun Production COMPARE\n";} sub help {print "\nHelp text\n";}

though you will need to add something to handle the default option