given and when were introduced back in Perl v5.10 I believe. But they have not been deprecated...I know deprecation of an accepted feature is very, very rare in Perl but these are marked as experimental. I've been looking at them more for curiosity than any need to use them.

Even with use experimental "switch"; they give a warning. I wasn't sure if this was on STDOUT or STDERR so I redirected STDERR and found that the warnings are not on there! I thought that use feature ... gave the warnings and use experimental ... didn't but in both cases I am getting the warnings. So, presumably, use warnings; overrides the experimental part.

#use v5.10; #use feature "switch"; use experimental "switch"; use strict; use warnings; # Redirect STDERR open my $fh, '>', 'error.log'; *STDERR = $fh; my $i = 3; given($i) { print "$i\n" when $i < 4; } # Prove STDERR is redirected with runtime error my $error = 10 / 0;

Given that deprecation is so very rare, is it safe to suppress the warnings and use some of the experimental features?


In reply to Experimental warnings with given/when by Bod

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.