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


in reply to How to zero-pad hex values in sprintf()?

Also, please see sprintf for a comprehensive discussion of the formatting specifiers available.