On Tue, May 31, 2011 at 4:34 PM, Uri Guttman <u...@stemsystems.com> wrote:
> just to show another way that is usually faster for prepending a string:
>
>        substr( $_, 0, 0, "$directory/" ) for @dirfiles[ 1 .. $#dirfiles ];
>
> that is called 4 arg substr and it is way underused in perl. this
> benchmark shows the significant speedup of about 2x:

Thanks, Uri. :) I never would have thought substr would support such a
feature. In fact, I just read the perldoc and it's quite impressive
how it can work as an lvalue too. That's what I love about Perl. :)


-- 
Brandon McCaig <http://www.bamccaig.com/> <bamcc...@gmail.com>
V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl.
Castopulence Software <http://www.castopulence.org/> <bamcc...@castopulence.org>

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to