in reply to Re: Re: Can I pad a number with leading spaces rather than leading 0's
in thread Can I pad a number with leading spaces rather than leading 0's
sprintf("\$%8.2f", $price) seems to forget about the padding up front.Works fine for me:
#!perl $price = 16.50; $formatted = sprintf("\$%8.2f", $price); print "Price is $price, formatted price is $formatted.\n"; __END__ Price is 16.5, formatted price is $ 16.50.
|
|---|