sub magic_opts { my ($lastopt,%opthash); for (split) { if (/^-+(.*)/) { $lastopt=$1; $opthash{$lastopt}=[]; } else { push @{$opthash{$lastopt}}, $_; } } return \%opthash; }