Deprecated: Assigning the return value of new by reference is deprecated in /home/sites/chengfu.net/www/wp-includes/cache.php on line 36 Deprecated: Assigning the return value of new by reference is deprecated in /home/sites/chengfu.net/www/wp-includes/query.php on line 21 Deprecated: Assigning the return value of new by reference is deprecated in /home/sites/chengfu.net/www/wp-includes/theme.php on line 507 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Deprecated: Function ereg() is deprecated in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php on line 62 Warning: Cannot modify header information - headers already sent by (output started at /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/functions.inc.php:62) in /home/sites/chengfu.net/www/wp-content/plugins/bad-behavior/screener.inc.php on line 8 #!/usr/bin/perl use strict; use Benchmark qw(cmpthese); my $string = '1-4-7-8-37-5-7-8-3-42'; my $count = 10000000; cmpthese($count, { 'match'=> sub { my $size = (scalar(@{[$string =~ /-/g]}) + 1) }, 'split' => sub { my $size = scalar(split /-/, $string); }, 'repl' => sub { my $size = (($string =~ s/-//g) + 1); }, 'tr' => sub { my $size = (($string =~ tr/-//) + 1) }, 'while' => sub { my $size = 1; $size++ while $string =~ /-/g; }, }); exit;