如何截断一个数字

问题描述 投票:0回答:1

我应该将数字显示到一个表格中。但我需要 数字后面只有两个字符,一个逗号。如何正确操作。

            $score =  $schet;
%>
            <tr class="ten" >
                <td class="six" > <%= $schet %></td>
                <td> <%= $d->start %></td>
                <td> <%= $d->end   %></td>
            </tr>
<%
        }
html perl numbers decimal truncate
1个回答
2
投票

使用 洒水:

my $number_with_two_decimal_places = sprintf '%.2f', $float;
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.