in reply to (s)printf question: eliminating plus sign before zeros

Here's something odd. I was trying to "improve" on Zaxo's solution and I discovered this:

printf "%*d", +4, $_ for @nums;

On my system at least, it works as Not_a_Number requested.

Update: D'oh! I conflated the output of two of my runs.

Replies are listed 'Best First'.
Re: Re: (s)printf question: eliminating plus sign before zeros
by Not_a_Number (Prior) on Dec 17, 2003 at 22:13 UTC

    Doesn't work for me (I get no plus signs before positive numbers) on WinXP AS 5.61.

    Output:

       1  -4   3   0  -2   0 -14

    dave