use strict; use Benchmark; timethese(1500000, { 'unpack' => 'unpack "H*", "abc"', 'sprintf' => 'sprintf "%x%x%x",ord("a"),ord("b"),ord("c")' } ); #### Benchmark: timing 1500000 iterations of sprintf, unpack... sprintf: 0 wallclock secs ( 0.17 usr + 0.00 sys = 0.17 CPU) @ 8823529.41/s (n=1500000) (warning: too few iterations for a reliable count) unpack: 10 wallclock secs ( 9.87 usr + 0.01 sys = 9.88 CPU) @ 151821.86/s (n=1500000)