{
    "mode": "perldoc",
    "parameter": "printf",
    "section": "-f",
    "url": "https://www.chedong.com/phpMan.php/perldoc/printf/json",
    "generated": "2026-06-03T05:23:04Z",
    "sections": [],
    "flags": [],
    "examples": [],
    "see_also": [],
    "tldr": {
        "source": "official",
        "description": "Format and print text.",
        "examples": [
            {
                "description": "Print a text message",
                "command": "printf \"{{%s\\n}}\" \"{{Hello world}}\""
            },
            {
                "description": "Print an integer in bold blue",
                "command": "printf \"{{\\e[1;34m%.3d\\e[0m\\n}}\" {{42}}"
            },
            {
                "description": "Print a float number with the Unicode Euro sign",
                "command": "printf \"{{\\u20AC %.2f\\n}}\" {{123.4}}"
            },
            {
                "description": "Print a text message composed with environment variables",
                "command": "printf \"{{var1: %s\\tvar2: %s\\n}}\" \"{{$VAR1}}\" \"{{$VAR2}}\""
            },
            {
                "description": "Store a formatted message in a variable (does not work on Zsh)",
                "command": "printf -v {{myvar}} {{\"This is %s = %d\\n\" \"a year\" 2016}}"
            },
            {
                "description": "Print a hexadecimal, octal, and scientific number",
                "command": "printf \"{{hex=%x octal=%o scientific=%e\\n}}\" 0x{{FF}} 0{{377}} {{100000}}"
            }
        ]
    }
}