in reply to Displaying big numbers as decimal
#!/usr/bin/perl use strict; my ($value) = 12345678901234567890; select (STDOUT); print "Output using sprint and %d := ", sprintf("%d", $value), "\n"; print "Output using sprint and %D (equivalent to %ld) := ", sprintf("% +D", $value), "\n"; print "Output using sprint and %f := ", sprintf("%f", $value), "\n"; print "Output using sprint and %.0f := ", sprintf("%.0f", $value), "\n +"; exit 0;
Output using sprint and %d := -1 Output using sprint and %D (equivalent to %ld) := -1 Output using sprint and %f := 12345678901234567168.000000 Output using sprint and %.0f := 12345678901234567168
|
|---|