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

  • 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
主站蜘蛛池模板: 临沂市| 清新县| 赫章县| 湖州市| 遂平县| 东山县| 文登市| 双流县| 佛山市| 泰宁县| 柘荣县| 安庆市| 古丈县| 云安县| 仪陇县| 瓮安县| 双峰县| 青田县| 沙雅县| 怀集县| 黑山县| 通榆县| 观塘区| 辽中县| 明溪县| 金塔县| 濮阳县| 南涧| 宣威市| 崇义县| 台江县| 莫力| 民县| 会理县| 柳河县| 庆云县| 阿荣旗| 泗洪县| 天峨县| 兴安县| 奉贤区|