It's just between c and d. You can see for yourself :: #!/usr/bin/perl
use Benchmark; @q = ('a','b','c','d','e'); if($ARGV[0]) { $var = $ARGV[0]; } else { $var = "<sdnlkhdfkjdfvkjdfnvjkd>\nhi\r "; } print "\n"; foreach $l(@q) { timethese(100000, { "Substitute and return test -$l-" => "$l(\$var)", }); print "\n"; } sub a { join '', split /^<|>$|\n|\r|\s$/, $_[0] } sub b { join '', split /^<|>$|\n|\r|\s$/, $_[0]; } sub c { $_[0] =~ s/^\<|\>$|\n|\r|\s$//g ? return $_[0] : return $_[0]; } sub d { $_[0] =~ s/^\<|\>$|\n|\r|\s$//g;return $_[0]; } sub e { $_[0] =~ s/^\<|\>$|\n|\r|\s$//g,$_[0]; } Thanks Dan > -----Original Message----- > From: david [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 11, 2003 4:15 PM > To: [EMAIL PROTECTED] > Subject: RE: return a regex substitution in one line > > > Dan Muey wrote: > > > Thanks again everyone for the replies. If any one casre here's some > > benchmark info I found out about our discussion :: > > > > Intersting what i found. If the sting is simple they're > about even. If > > the string is complicated( has more matches/substitutions) > it takes a > > and b the same ( probably due to having to split ans join > it )cd and d > > very close but d slightly faster usually. > > > > can you also benchmark the one i post? i am just curious, > nothing else. > > david > > -- > 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]