programming-examples/perl/String/%.2f specifies a floating-point number with two decimal digits.pl
2019-11-15 12:59:38 +01:00

7 lines
107 B
Perl

#!/usr/bin/perl -w
$f = 123.45;
printf("f=%.2f, f=%.5f, f=%3.2f, f=%1.2f\n",
$f, $f, $f, $f);