Vam*_*a B 3 perl cpan numbers perl-module
我需要一个Perl脚本,它将数字作为输入示例222,它应该输出为二百二十二.
Nik*_*ain 15
使用Lingua :: EN :: Numbers - 将"407"变成"四百七十"等.
use Lingua::EN::Numbers qw(num2en num2en_ordinal);
my $x = 234;
my $y = 54;
print "You have ", num2en($x), " things to do today!\n";
print "You will stop caring after the ", num2en_ordinal($y), ".\n";
Run Code Online (Sandbox Code Playgroud)
打印:
You have two hundred and thirty-four things to do today!
You will stop caring after the fifty-fourth.
Run Code Online (Sandbox Code Playgroud)
如果您阅读该模块的文档,那么您会发现该模块还支持以下内容,例如:
Number :: Spell可以帮到你:
use Number::Spell;
my $str = spell_number(222);
Run Code Online (Sandbox Code Playgroud)