in reply to Re: v5.36 syntax error around given/when
in thread v5.36 syntax error around given/when

Thanks! So, in order to allow my method of processing command line options to continue to work while using the v5.36 features, I can write:
use v5.36; use feature qw/switch/; no warnings "experimental::smartmatch"; no warnings "experimental::for_list"; for my ( $opt, $val ) (%$opts ) { given ($opt) { when ('h') { HELP_MESSAGE(); } when ('v') { ++$verbose; } when ('r') { ++$recursive; } when ('c') { ++$confirm; } when ('f') { ++$force; } default { die "*** BUG: no handler for -$opt.\n"; } } }
To me, this reads the best. I guess that if given goes away I'll replace it with for .. reluctantly, because "for" has always implied looping to me.