Mega Code Archive

 
Categories / Perl / String
 

Format Options for sprintf and printf

Option      Meaning %c      Insert a single character. %d      Insert an integer value. %e      Insert a floating-point value in scientific notation format. %f      Insert a floating-point value. %g      Insert a floating-point value in scientific notation format. %i      Insert a signed integer value. %o      Insert an integer in octal (base 8) format. %s      Insert a string value. %u      Insert an unsigned integer value. %x      Insert an integer and display in hexadecimal (base 16) format. (%X forces the hexadecimal digits to appear uppercase.)