in reply to Re: 'switch' and 'smartmatch' features deprecated in 5.38
in thread 'switch' and 'smartmatch' features deprecated in 5.38

I guess for sheer conciseness this would work:
for ( keys %opts ) { /h/ ? HELP_MESSAGE() : /v/ ? ++$verbose : /f/ ? ++$force : /t/ ? $table = $opts{$_} : die "*** BUG: no handler for -$_.\n"; }

Replies are listed 'Best First'.
Re^3: 'switch' and 'smartmatch' features deprecated in 5.38
by swl (Prior) on Jun 28, 2023 at 01:53 UTC

    Although one should first check the keys are all single letter for this case, otherwise one will get matches for words like haft, vatful and thrive.

      %opts was populated by Getopt::Std, so the keys are guaranteed to be one character.