in reply to Re^4: How to calculate the sum of columns to be equal to 100?
in thread How to calculate the sum of columns to be equal to 100?
The trick works for me on DWIM Perl 5.14.2:
11:55 >perl -wE "printf qq[%9f\t%.0f\t%2.0f\n], ($_ + 0.5) x 3 for 0 . +. 10;" 0.500000 0 1 1.500000 2 2 2.500000 2 3 3.500000 4 4 4.500000 4 5 5.500000 6 6 6.500000 6 7 7.500000 8 8 8.500000 8 9 9.500000 10 10 10.500000 10 11 11:55 >perl -v This is perl 5, version 14, subversion 2 (v5.14.2) built for MSWin32-x +86-multi-thread
Likewise on my 3 Strawberry Perls:
I’m running under Windows Vista 32-bit. So it seems that Perl’s printf behaves differently under Windows. No mention of this in perlport or perlwin32, though. Strange.
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|