Perhaps too complicated if you're just replacing a few lines but if I understand this right if you're doing many lines, like say updating entries in database then this mat cut the time down considerably.
Could you try to explain a little what's going on in those two examples and perhaps why the second takes appx half the time to do? I'd love to understand this better. Thanks Dan -----Original Message----- From: John W. Krahn [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 08, 2003 9:37 AM To: [EMAIL PROTECTED] Subject: Re: String manipulation benchmark 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] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]