use Getopt::Mixed; { Getopt::Mixed::init(' a b c d e alpha>a bravo>b charlie>c delta>d echo>e '); my $restricted = 0; my %go; while( my( $option, $value, $pretty ) = Getopt::Mixed::nextOption() ) { ++$restricted; $go{$option}++; } Getopt::Mixed::cleanup(); sub go { my $stage = shift; return 1 unless $restricted; $go{$stage} ? 1 : 0; } } go('a') and stage_a(); go('b') and stage_b(); ... sub stage_a { ... } #### use Getopt::Mixed; { Getopt::Mixed::init(' a b c d e alpha>a bravo>b charlie>c delta>d echo>e '); my %go; while( my( $option, $value, $pretty ) = Getopt::Mixed::nextOption() ) { $go{$option}++; } Getopt::Mixed::cleanup(); sub go { 0 == scalar keys %go or defined( $go{$_[0]} ) } } go('a') and stage_a(); go('b') and stage_b(); ... sub stage_a { ... }