"John W. Krahn" schreef:

> Also the format "%2.0f" says to print the argument as a floating point
> number but not print the "floating point" part which is effectively
> the same as printing the argument as an integer using "%2d".


No, %d truncates, %f evens:

perl -wle'
    printf("%1\$4.1f: %1\$2d  %1\$2.0f\n", $_ + 0.5) for -2..4;
'
-1.5: -1  -2
-0.5:  0  -0
 0.5:  0   0
 1.5:  1   2
 2.5:  2   2
 3.5:  3   4
 4.5:  4   4

-- 
Affijn, Ruud

"Gewoon is een tijger."


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to