my $str = 'hello'; timethese( 1000000, { 'pack' => q{$str = pack("A10",$str); }, 'sprintf' => q{$str = sprintf("%-10s",$str); }, });