Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hi cheselton,

The easiest way to get rid of the warning on all Perls v5.10 and above is the following, taken from here, which also briefly explains the rationale for making it experimental:

no if $] ge '5.018', warnings => "experimental::smartmatch";

And I think the best way to enable the smartmatch feature is use 5.010_001; (see "Feature Bundles" and the section following it, "Implicit Loading"). I suggest Perl v5.10.1 because there were some significant changes to the way smartmatching and given/when works.

Update: I should add that because of its experimental state and the fact that the behaviour might change later, I now avoid given/when and use if/elsif or one of the other alternatives like dispatch tables instead. In fact, I sometimes begin Perl scripts with the somewhat clumsy use 5.010; no feature 'switch'; when I want to have v5.10 as my minimum version but want to avoid accidentally using given/when.

There's also been several discussions here on PerlMonks, for example Bring back the smartmatch operator (but with sane semantics this time)!, which includes this post listing some of the alternatives available on CPAN. Hopefully we will get back a working given/when someday :-)

Hope this helps,
-- Hauke D

Update: Expanded post slightly. Yet Another Update: Used ge rather than >= as explained here.


In reply to Re: Best option for "switch/case" functionality? by haukex
in thread Best option for "switch/case" functionality? by cheselton

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found