in reply to english numbers to chinese numbers
Please save yourself some effort in future and use <code> ... </code> tags; please see Markup in the Monastery and Writeup Formatting Tips.
my $n=$number/10000;
$n=~s/\..*//;
The purpose of the s/\..*// substitution seems to to be to truncate a number to an integer. The built-in function int exists for this purpose
my $n = int($number/10000);
or one could simply put a useinteger; statement at the beginning of one's code and all arithmetic operations thereafter will be integer operations:
use warnings; use strict; use integer; ... my $n = $number/10000; ... my $n = $number/1000; ...
Give a man a fish: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: english numbers to chinese numbers (updated)
by haukex (Archbishop) on Feb 08, 2017 at 08:21 UTC |