programming-examples/perl/String/%.2f specifies a floating-point number with two decimal digits.pl

7 lines
107 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/usr/bin/perl -w
$f = 123.45;
printf("f=%.2f, f=%.5f, f=%3.2f, f=%1.2f\n",
$f, $f, $f, $f);