Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: To splice or not to splice? What implementation is more readable, efficient, etc.?

by Anonymous Monk
on Feb 18, 2017 at 21:21 UTC ( [id://1182288]=note: print w/replies, xml ) Need Help??


in reply to To splice or not to splice? What implementation is more readable, efficient, etc.?

Hi

The way to know which is faster is to Benchmark

The map versions are all identical :) from a "style" point of view

The way to decide between SPLIT_IF_FOO and SPLIT_FOO is not based on chracter count in a map, but which is more useful/generic, which verbs/actions the problem ...

map/splice/foreach, they're all idiotmatic

The only problem with your c-style for loop is modifying $i in two different places

If the only goal of this code is to expand_foo $items, there should be no maps or splices anywhere, just simple recursion with a foreach

* no not even map in void context thats poor style

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-03-29 10:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found