http://www.perlmonks.org?node_id=966130


in reply to Function to produce formatted ord values of a string

If the speed really matter, then go with this:
sub new_dump_buf_3 { my $buf = shift; sprintf q{%3d } x (length($buf) - 1) . q{%3d}, unpack 'C*', $buf; }