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

    Hi AnomalousMonk,

    use <code> ... </code> tags

    AFAIK <code> tags don't do unicode:

    # result: &#19977;&#19975;&#38646;&#20843;&#30334;&#38646;&#20845;

    Although the post will be missing the [download] link, I'd suggest <pre> tags:

    # result: 三万零八百零六
    

    Update: Or, of course, the OP could use plain ASCII and write unicode characters as e.g. \x{4e09}.

    Regards,
    -- Hauke D