in reply to Re^7: Find Prefix if regex didn't match
in thread Find Prefix if regex didn't match
#!/usr/bin/perl -- use Benchmark qw/ cmpthese /; print "$]\n"; my $what1 = 'WWWA'; my $what2 = $what1; cmpthese( -3, { circumcised => sub { $what1 =~ /EB.*Z/; # fail one $what1 .='DBBBABC'; substr $what1, 0, 8, ''; $what1 =~ /EB.*Z/; # fail another return; }, uncut => sub { $what2 =~ /EB.*Z/; # fail one $what2 .='DBBBABC'; $what2 =~ /EB.*Z/; # fail another return; }, }, ); print "\n\n"; __END__ 5.010001 Rate uncut circumcised uncut 2735/s -- -100% circumcised 3398892/s 124179% --
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^9: Find Prefix if regex didn't match
by Anonymous Monk on Nov 06, 2012 at 13:18 UTC | |
by demoralizer (Beadle) on Nov 07, 2012 at 06:31 UTC |