##
my %opts;
@opts{@switches} = ();
####
my $curswitch;
for (@values) {
exists $opts{$_} ?
$curswitch = \$opts{$_}, next
: die "Unknown switch: $_\n"
if /^-/;
defined $curswitch or die "Not a switch: $_\n";
push @$curswitch, $_;
}