Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^6: $_ functions vs argument-using functions

by tobyink (Abbot)
on Sep 09, 2013 at 22:40 UTC ( #1053116=note: print w/ replies, xml ) Need Help??


in reply to Re^5: $_ functions vs argument-using functions
in thread $_ functions vs argument-using functions

As I said, the block form does add a little overhead, because it creates a lexical scope. It's very minor though, so it's generally better to go with whatever you think is more readable.

When you need to micro-optimize a tight loop that gets called millions or billions of times... that's when you start looking at removing unnecessary lexical scopes! The block forms of grep and map can be replaced with the expression forms; if/elsif/else chains can become ternary operator expressions; foreach blocks become statement modifiers; etc.

use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name


Comment on Re^6: $_ functions vs argument-using functions
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2014-12-26 11:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (171 votes), past polls