http://qs1969.pair.com?node_id=11144629


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

G'day ibm1620,

"I know that given is still experimental (and unpopular), but I thought it was still supported by 5.36."

The release notes, perl5360delta, whose first section is "use v5.36", has:

"... with this release, the experimental switch feature, present in every feature bundle since they were introduced in v5.10, has been removed from the v5.36 bundle. ..."

See "perlsyn: Switch Statements" for more about the switch feature.

— Ken

Replies are listed 'Best First'.
Re^2: v5.36 syntax error around given/when
by ibm1620 (Hermit) on Jun 10, 2022 at 14:01 UTC
    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.