in reply to Experimental warnings with given/when

G'day Bod,

"I've been looking at them more for curiosity than any need to use them."

They became experimental in 5.18.0 - see "perl5180delta". Of immediate interest to you, in that rather lengthy page, are probably these sections: "The smartmatch family of features are now experimental"; and, "New mechanism for experimental features".

Also look at the documentation for the pragmata: feature and experimental. The "Ordering matters" section in the latter holds the answer to your problem.

Here's a cutdown version of what you're doing:

$ perl -E ' use strict; use experimental "switch"; use warnings; given (1) { say "Hello" } ' given is experimental at -e line 6. Hello

Taking the advice of the Ordering matters section, and the warning disappears:

$ perl -E ' use strict; use warnings; use experimental "switch"; given (1) { say "Hello" } ' Hello

— Ken