Hi,
Seems that if you 'use strict' (or even simply declare with 'my') then none
of the variables can be accessed by a Benchmark test.
To illustrate:
#! perl -w
use strict;
use Benchmark;
my @one = (1..10);
my @two = (11..20);
timethese (5, {
'one' => 'print scalar(@one), "\n";',
'two' => 'print scalar(@two), "\n";',
});
This produces:
Benchmark: timing 5 iterations of one, two...
0
0
0
0
0
one: 0 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
(warning: too few iterations for a reliable count)
0
0
0
0
0
two: 0 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
(warning: too few iterations for a reliable count)
To obtain the "correct" output (where the columns of '0's are replaced by
columns of '10's) I need to firstly delete 'use strict' and secondly delete
both occurrences of 'my'.
That's a rather tedious fix, and can also involve renaming of variables.
Is there a simpler way ?
Not much point in doing a benchmark if it thinks that every scalar and every
array is empty ... though it does often produce pleasingly quick timings
:-)
Cheers,
Rob
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs