You can get rid of that pesky + by changing: printf '%+4d', $_ for @nums; to printf '%+4.0f', $_||-.1 for @nums; Update: yes, that will produce "-0" which is correct behaviour for negative numbers that printf %f has to round to 0.
In reply to Re: (s)printf question: eliminating plus sign before zeros
by ysth
in thread (s)printf question: eliminating plus sign before zeros
by Not_a_Number
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |