#!/usr/bin/env perl use warnings; use strict; use Getopt::Long; GetOptions( 'first' => \&first, 'second' => \&second, 'help' => \&help, ) or die "Invalid options passed to $0\n"; sub first () { print "Processing sub first\n"; } sub second () { print "Processing sub second\n"; } sub help () { print "Available options are: \n"; print "\t--first\n"; print "\t--second\n"; print "\t--third\n"; print "\t--fourth\n"; print "\t--help\n"; }