in reply to Formatting number

try this $num=25000 $num =~ s/0/\,0/; yak

Replies are listed 'Best First'.
Re: Re: Formatting number
by sgifford (Prior) on Jul 31, 2003 at 19:42 UTC
    That will only work if the first zero to occur is exactly where the comma should go:
    $ perl -e '$num=10; $num =~ s/0/\,0/; print $num,"\n";'
    1,0
    $ perl -e '$num=25500; $num =~ s/0/\,0/; print $num,"\n";' 
    255,00
    $ perl -e '$num=250000000; $num =~ s/0/\,0/; print $num,"\n";'
    25,0000000