P is for Practical | |
PerlMonks |
Re^3: Counting the number of items returned by split without using a named arrayby Anonymous Monk |
on May 04, 2006 at 12:35 UTC ( [id://547402]=note: print w/replies, xml ) | Need Help?? |
pretty amazing, that "optimization":
BUT:
so it's not completely impossible to use it with split, just limited to a fixed maximum number of fields in the split. It's a bit unsuspected (at least for me) though, that an explicit split(" ",$_,0) was 'optimized' also. Btw - just out of curiosity put this version in the benchmark also - and it's faster than the regexp version, but still slower than $n = @{[ split ]}; I.
In Section
Seekers of Perl Wisdom
|
|