Folks, Either perl 5 or libc is wrong (or my testcase is bogus, or the standard ...):
$ perl -e'printf("!%03.2d!\n", 1)' !001! $ cc -Wall sprintf.c -o sprintf && ./sprintf '%03.2d' 1 # [1] ! 01! Parrot is currently following the 'official' aka libc behavior and is returning the latter result [2]. Not that I really need that, but the test is complaining ... leo [1] $ cat sprintf.c #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { char *arg; char fmt[256]; int i; if (argc != 3) { printf("usage: ./sprintf fmt int_arg\n"); return (1); } arg = argv[2]; i = atoi(arg); sprintf(fmt, "!%s!\n", argv[1]); printf(fmt, i); return 0; } [2] $ cat spf.pasm new P1, .ResizablePMCArray push P1, 1 sprintf S0, "!%03.2d!\n", P1 print S0 end $ ./parrot spf.pasm ! 01!