Mega Code Archive
Categories
/
Perl
/
String
% 2f specifies a floating-point number with two decimal digits
#!/usr/bin/perl -w $f = 123.45; printf("f=%.2f, f=%.5f, f=%3.2f, f=%1.2f\n", $f, $f, $f, $f);