in reply to Re: Re: Matching First Character of Strings Efficiently
in thread Matching First Character of Strings Efficiently
Well, if this is in a tight loop, then you might gain a bit by not building a scope each time through the loop:
expensive_function($str_a , $str_b) unless ($letter eq substr $str_b,0 +,1);
IOW, get rid of the curlies. I'd be curious to find out if this really has any significant effect...
Or even...
expensive_function($str_a , $_) unless ($letter eq substr $_,0,1) for @list;
... if we are free to play with $_ (otherwise predeclaring $str_b will work too).
|
|---|