It turns out rgb:12/3/45 is the same as rgb:12/33/45 rather than rgb:12/03/45, so that perl script needs to use %02x in its printf: