Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Perl >> Snippet

print formatting


print

printf formatstring, list

printf filehandle formatstring, list         # note that there is no comma after filehandle

sprintf                    # same as printf, except returns a string

formatstring:   "%-w.dx"    # prints all characters except those begining with % (mandatory)
                          # - is left justifed, otherwise right justified (optional)
                          # w is width (optional)
                          # d for numbers is numbers to left of decimal position (optional)
                          # d for strings total width (optional)
                          # x type of data to be printed c-character, s-string
                          # x type of data to be printer d-integer (truncated), f-floating point