Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Best option for "switch/case" functionality? (magic numbers)

by tye (Sage)
on Jun 28, 2016 at 18:18 UTC ( [id://1166813]=note: print w/replies, xml ) Need Help??


in reply to Re: Best option for "switch/case" functionality?
in thread Best option for "switch/case" functionality?

Rather than hard-code the "magic number"` '5.018', I'd go with

BEGIN { eval { require warnings; warnings->unimport('experimental::sma +rtmatch') } }

- tye        

  • Comment on Re^2: Best option for "switch/case" functionality? (magic numbers)
  • Download Code

Replies are listed 'Best First'.
Re^3: Best option for "switch/case" functionality? (magic numbers)
by Anonymous Monk on Jun 29, 2016 at 00:09 UTC
    Isn't that lexical to the BEGIN{} block?

      Nope. Otherwise, 'use' couldn't work as it is just syntactic sugar for pretty much what I wrote (well, 'no' more than 'use' in this case). Now, if you put 'use' in a BEGIN block, then it could have impacts lexically scoped to the BEGIN block, but that is because it would be short for:

      BEGIN { BEGIN { require ...; ...->import( ... ) } }

      - tye        

        The eval block?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-19 01:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found