Hi Bill, Great, I will try it out.
Thanks > -----Original Message----- > From: $Bill Luebkert [mailto:[EMAIL PROTECTED]] > Sent: 20. februar 2003 15:34 > To: Henrik Schak Hansen > Cc: '[EMAIL PROTECTED]' > Subject: Re: printf > > > Henrik Schak Hansen wrote: > > Hi All, > > > > Can somebody help me with the following task: > > I want to print a real number using printf. > > > > $value = 5120100.32; > > printf("????",$value); > > > > the output should be: > > 5.120.100,32 > > > > Notice that this is the european/danish way of showing > numbers, meaning > > that thousands are seperated by . and the fraction/decimal > is seperated > > by , (comma). Is there a way to do this ? > > If the locale is set, the ,32 part should get in there from > the printf. > > printf "%.2f", $value; > > For the .'s, modify commify below to dotify or whatever: > > sub commify { # $ret = commify ($number) > local $_ = shift; > return $_ if tr/0-9/0-9/ < 4; > 1 while s/^\s*([-+]?\d+)(\d{3})/$1,$2/; # replace the > last , with . for europe > return $_; > } > > -- > ,-/- __ _ _ $Bill Luebkert ICQ=162126130 > (_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED] > / ) /--< o // // http://dbecoll.tripod.com/ (Free > site for Perl) > -/-' /___/_<_</_</_ Castle of Medieval Myth & Magic http://www.todbe.com/ ------- [Denne E-mail blev scannet for virus af Declude Virus] [This E-mail was scanned for viruses by Declude Virus] ------- [Denne E-mail blev scannet for virus af Declude Virus] [This E-mail was scanned for viruses by Declude Virus] _______________________________________________ ActivePerl mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
