#!/usr/bin/env perl use Getopt::Long; GetOptions(\my %h ,qw(a:s b c d) ,qw(e=s f g h) ,qw(i:o j k l m n) ,qw(o=o p q r s t) ,qw(u:f w x) ,qw(y=f z) ); ### dump: %h ### 'Order them ...' my $command_line; for my $option ('a'..'z') { $command_line.="$option " if (exists $h{$option}); } ### dump: $command_line ### 'Parse $command_line with a regex ...' if ($command_line !~ m{^(\ba\b( [b..d])|e|i|o|u|y) $}) { # conflicting options die "Conflicting options in '$command_line'!"; } ### "We're good to go with '$command_line'!" exit;