Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^2: Concatenate or Join?by tobyink (Canon) |
on Nov 12, 2012 at 20:54 UTC ( [id://1003507]=note: print w/replies, xml ) | Need Help?? |
It depends what you're doing really. In your example, join beats concat, but that's because you are looping through an array. Here though, concatenation beats it (albeit only by about 10%):
And here (thanks to the Perl compiler being so good at constant folding) concatenation is more than twice as fast as join:
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
In Section
Seekers of Perl Wisdom
|
|