Pavle Lukic wrote:
> 
> Hi

Hello,

> I did a little benchmarking in regard to the
> string manipulation issue raised on this forum.
> 
> Here are relevant parameters and benchmark results.
> 
> Problem
> Given a string and a pattern, construct new string
> by removing part of the string equal to pattern.
> Remove only first occurrence of the pattern.
> 
> Problem solutions
> 
> Solution #1 ($x = $a) =~ s/\Q$b//;
> 
> Solution #2  $x = substr($a,0,index($a,$b)).substr($a,index($a,$b)+length($b));

Too complicated.  :-)

substr $x = $a, index( $a, $b ), length( $b ), '';



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to