in reply to Re^3: Counting the number of items returned by split without using a named array
in thread Counting the number of items returned by split without using a named array
As you wish (or not):
$ cat foo.pl ; echo "--------";echo; ./foo.pl #!/usr/bin/perl ################## use Benchmark qw(:all) ; sub test1(){ $entries = @{[ split ]}; } sub test2(){ $entries = () = /\S+/g; } $_="This is an example string with several words bla bla bla\n"; $count=1E+7; timethis ($count, "test1()"); print "------------\n"; timethis ($count, "test2()"); -------- timethis 10000000: 13 wallclock secs (12.37 usr + 0.01 sys = 12.38 CP +U) @ 807754.44/s (n=10000000) ------------ timethis 10000000: 7 wallclock secs ( 6.66 usr + 0.00 sys = 6.66 CP +U) @ 1501501.50/s (n=10000000)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Counting the number of items returned by split without using a named array
by blazar (Canon) on May 04, 2006 at 10:49 UTC |
In Section
Seekers of Perl Wisdom