Perhaps a locale setting from one of the POSIX:: modules might help? I haven't used locale stuff but it may do exactly the desired thing.
Also you could use sprintf instead of printf and then fix up the result. Like:
#(other program stuff here) my $a=10.5; my $str=sprintf "%.1f",$a; $str =~ s/\.(\d)$/,$1/; #only do the last . and preserve the digit print $str; #(and more program stuff here)
Of course some of the lines could be collapsed together to make it less lines of code.
In reply to Re: Using printf with %.1f
by dga
in thread Using printf with %.1f
by alexsc01
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |