Felix Geerinckx wrote: > > Now you're talking. > But just for the fun of it, run the benchmark again with the OP's original > (much longer) string ... ;-) >
testing result for a longer string(i use the one from the OP).i add a few new lines to make it more readable: Benchmark: timing 999999 iterations of search_assign, search_replace, substr... search_assign: 51 wallclock secs (22.73 usr + 0.02 sys = 22.75 CPU) @ 43956.00/s (n=999999) search_replace: 37 wallclock secs (17.29 usr + 0.01 sys = 17.30 CPU) @ 57803.41/s (n=999999) substr: 10 wallclock secs ( 4.40 usr + 0.00 sys = 4.40 CPU) @ 227272.50/s (n=999999) essentially: search_assign is: ($_) = /(\S+).$/; search_replace: is: s/.*\[uuid (.*)\]/$1/; substr is: ($_ = substr($_,rindex($_,' ')+1)) =~ s/.$//; so for a shorter string, the search_assign thingy is faster. for a longer string the search_replace appoach is faster. but in all cases, the substr appoach is faster(sometimes much faster) than the other appocach... nice to know. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]