- 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
推薦閱讀
- 自己動手寫Java虛擬機
- 基于免疫進化的算法及應用研究
- Visual C++串口通信技術(shù)詳解(第2版)
- Python程序設(shè)計案例教程
- TypeScript圖形渲染實戰(zhàn):基于WebGL的3D架構(gòu)與實現(xiàn)
- Hands-On Microservices with Kotlin
- Java編程技術(shù)與項目實戰(zhàn)(第2版)
- Mastering Apache Maven 3
- D3.js 4.x Data Visualization(Third Edition)
- Swift細致入門與最佳實踐
- 微信小程序開發(fā)與實戰(zhàn)(微課版)
- INSTANT Yii 1.1 Application Development Starter
- Raspberry Pi Robotic Blueprints
- 編程改變生活:用Python提升你的能力(進階篇·微課視頻版)
- Web前端開發(fā)技術(shù):HTML、CSS、JavaScript