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?? |
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
In Section
Seekers of Perl Wisdom
|
|