#PSEUDOCODE # setting deafult is useful my $chars = 70; # chars per line my %display = (name=>'screen'); my $bw; # not monochromo by default # Getopt::Long part assign command line provided values to $chars and $display{name} .. # validation and exclusion my @checks = ( [\$display{name}, sub{ if ($display{name} eq 'tv'){ $chars = 35; $bw = undef; } print "--display tv sets --chars to 35 and clean --monochromo\n" }], [\$chars, sub{die "chars 12-140!" if ($chars<12 || $chars>140)} ], [\$bw, undef] ); foreach my $i (0..$#checks){ if defined the 0th element and also the first one, execute the latter