"be consistent" | |
PerlMonks |
Re: Re2: split questionby BrowserUk (Patriarch) |
on Sep 20, 2002 at 21:28 UTC ( [id://199635]=note: print w/replies, xml ) | Need Help?? |
That'll teach me to try and one-line my original solution.:( For what it's worth, I didn't say that the last one would be more efficient, but I did say it would work ;(. The original was
but I didn't like the double test against -1, so I tried to get rid of it. Don't know how I missed that it printed the extra one. A case of seeing what I wanted to see I guess. I'm not that surprised that doing the looping inside the regex engine is more efficient than at user level. I'm guessing that it makes a single pass looking for fixed anchors like the : when the /g options is used. I am surprised how much more efficient it is. Nice benchmark BTW. Something I need to get better at. Cor! Like yer ring! ... HALO dammit! ... 'Ave it yer way! Hal-lo, Mister la-de-da. ... Like yer ring!
In Section
Seekers of Perl Wisdom
|
|