There is no printf format which does that, so far as I know. Your solution is about what you need to do. It can be simplified a bit, printf +( $_ ? '%+4d' : '%4d' ), $_ for @nums;
After Compline,
Zaxo
In reply to Re: (s)printf question: eliminating plus sign before zeros
by Zaxo
in thread (s)printf question: eliminating plus sign before zeros
by Not_a_Number
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |