in reply to Re^3: Can sprintf suppress leading zero for float < 1?
in thread Can sprintf suppress leading zero for float < 1?

Need to handle negative numbers as well. How about this?

#!/usr/bin/perl my $value = .23456; my $formatted = sprintf("%.3f", $value); $formatted =~ s/([^0-9])0\./$1./; print "$value => $formatted\n"; $value = $formatted = -.23456; $formatted = sprintf("%.3f", $value); $formatted =~ s/([^0-9])0\./$1./; print "$value => $formatted\n";