if ($command eq 'add' || $command eq 'a') { if (GetOptions(\%hash, 'name=s', 'value=i')) { &doSomething(); } } elsif ($command eq 'edit' || $command eq 'e') { ... } #### # not tested %commands = ( 'add' => '&add', 'a' => '\$command{add}', 'view' => '&view', 'v' => '\$command{view}', ); while () { # or whatever $command{$_}; # or is it '\$command{$_}' ? ... } sub add { GetOptions(\%hash, 'name=s', 'value=i'); # your code here } sub view { GetOptions( ... ); # your code here }