> Is there a simpler way ?
---
use strict;
use Benchmark;
timethese (-1, {
one => 'my @one = (1..10);
my @two = (11..20);
scalar(@one);',
two => 'my @one = (1..10);
my @two = (11..20);
scalar(@two), "\n";'
});
---
Benchmark: running one, two, each for at least 1
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