What is the difference between
sprintf just returns a formatted string,
printf prints it to a filehandle.
printf HANDLE "%s", $arg
can (very redundantly) be written as
$formatted = sprintf "%s", $arg print HANDLE $formatted
Of course, this specific example is most naturally written as
print HANDLE $arg
because the format string I used for an example is so trivial as to be useless.
Of course, HANDLE is optional, and defaults to STDOUT, although you can also change the default with