sprintf
Formats a string according to a printf-style format specification.
Takes a format string followed by a list of arguments (from a pushmark-delimited argument list on the stack) and returns the formatted result string. Supports the standard C-style conversion specifiers:
%sstring,%d/%isigned decimal,%uunsigned decimal%ooctal,%x/%Xhex,%b/%Bbinary%e/%Escientific,%f/%Ffixed,%g/%Ggeneral float%ccharacter (by codepoint),%ppointer,%%literal percent
Flags: - (left-justify), + (force sign), (space for sign),
0 (zero-pad), # (alternate form). Width and precision may be
literal or * (consumed from the argument list). Indexed arguments
via %N$ are supported. The %vd vector flag formats a string as
dot-separated byte values (e.g. version strings).
Uses a zero-allocation fast path: arguments are peeked from the stack
as &[Sv] without cloning, and integer formatting uses stack buffers.
Synopsis
$s = sprintf('%d items at $%.2f each', $count, $price);
$s = sprintf('%05x', $hex_val);
$s = sprintf('%-20s', $name);