官术网_书友最值得收藏!

  • Perl 6 Deep Dive
  • Andrew Shitov
  • 89字
  • 2021-07-03 00:05:51

Getting the Perl representation of the value

The perl method returns a string that can represent the Rat value as Perl 6 understands it in the source code. The result can either contain a decimal point or a slash, depending on what is better for precise representation of the value.

Consider a couple of examples that display the preceding idea:

my $x = 1/3;
say $x.perl; # <1/3>

my $y = 1/2;
say $y.perl; # 0.5

Even more, the following code is valid Perl 6 code:

say 10/20.perl; # 0.5
主站蜘蛛池模板: 黄骅市| 运城市| 白河县| 榆树市| 平顶山市| 宜春市| 阳城县| 鹿泉市| 中方县| 和平县| 观塘区| 小金县| 建阳市| 常熟市| 政和县| 吴旗县| 黄梅县| 竹北市| 广安市| 钟山县| 遵义县| 博客| 南昌县| 新巴尔虎左旗| 凌云县| 武城县| 咸阳市| 曲沃县| 邓州市| 雷山县| 将乐县| 呼玛县| 黑水县| 磐石市| 伊春市| 民县| 鲁山县| 察隅县| 滨海县| 隆化县| 蒙自县|