vinaynp has asked for the wisdom of the Perl Monks concerning the following question:
The below set of statements prints 40000. How can I control the length of the float using printf to print 4000 even though the value of num is 40000?my $string = "Vinay"; printf('%-4.4s', $string); print "\n";
my $num = 40000; printf('%4.0f', $num); print "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Length of float using printf
by bart (Canon) on Jun 02, 2009 at 18:35 UTC | |
by ikegami (Patriarch) on Jun 02, 2009 at 18:43 UTC | |
by vinaynp (Initiate) on Jun 02, 2009 at 19:10 UTC | |
by vinaynp (Initiate) on Jun 02, 2009 at 18:42 UTC | |
by ikegami (Patriarch) on Jun 02, 2009 at 18:47 UTC |