Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: v5.36 syntax error around given/when

by kcott (Archbishop)
on Jun 09, 2022 at 23:14 UTC ( [id://11144629]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11144629]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-03-28 17:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found