use Benchmark::Timer; $T = new Benchmark::Timer; $T->start( 'scalar'), $x = ' ' x 2**24, $T->stop( 'scalar' ) for 1 .. 10; $T->report; 10 trials of scalar (359.375ms total), 35.938ms/trial