[Chapter 3] 3.2.111 printf
Author: Larry Wall, Tom Christiansen & Randal L. Schwartz
Date: 1999-07-02T01:52:30Z

#

| Chapter 3 Functions |

### 3.2.111 printf

    printf FILEHANDLE FORMAT LIST
    printf FORMAT LIST

This function prints a formatted string to `FILEHANDLE` or, if omitted, the currently selected output filehandle, initially `STDOUT`. The first item in the `LIST` must be a string that says how to format the rest of the items. This is similar to the C library's printf(3) and fprintf(3) function, except that the `*` field width specifier is not supported. The function is equivalent to:

    print FILEHANDLE sprintf LIST

See print and sprintf. The description of sprintf includes the list of acceptable specifications for the format string.

Don't fall into the trap of using a printf when a simple print would do. The print is more efficient, and less error prone.

3.2.110 print |  | 3.2.112 push