$Bill Luebkert <[EMAIL PROTECTED]> wrote:
> Kristofer Wolff wrote:
> > 
> > hi I am priniting out procents like:
> > 
> >                                 $procent = ($d*100)/$sum;
> >                                 print "$procent %";
> > 
> > but now i have somthing like: "13,832548 %" how can I round this to a 2
> > string thing after the komma ?
> 
> It's 'percent' in English.  :)
> 
> printf "%.2f %%", $d * 100 / $sum;

I think he needs something more like

  my $pct = sprintf "%.2f %%", $d * 100 / $sum;
  $pct =~ tr/./,/; # change period to comma
  print $pct;

-- 
Keith C. Ivey <[EMAIL PROTECTED]>
Washington, DC
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to