#!/usr/local/bin/perl -w use Getopt::Long; use Pod::Usage; use strict; # Parse command line arguments and assign corresponding variables GetOptions ( 'a|add' => \( my $ADD = undef ), 'r|remove' => \( my $REMOVE = undef ), 'd|delete' => \( my $DELETE = undef ), ); unless ( defined $ADD or defined $REMOVE or defined $DELETE ) { pod2usage( -exitval => 1, -output => \*STDERR ); } if ($ADD) { ... } if ($REMOVE) { ... } if ($DELETE) { ... }