我正在Perl6中打印数据,Data::Printer这是一个很棒的程序包,但是我试图更改参数,但我不能。
例如,我想要:
HG00112 {
gained_site {
9:10162 0,
9:10272 var{HG00112}{gained_site}{9:10162},
9:10326 var{HG00112}{gained_site}{9:10162},
...
}(tied to Perl6::Hash)
Run Code Online (Sandbox Code Playgroud)
看起来像
HG00112 {
gained_site {
9:10162 0,
9:10272 0,
9:10326 0,
...
}(tied to Perl6::Hash)
Run Code Online (Sandbox Code Playgroud)
易于阅读(我不在乎tied to Perl6::Hash)
可以使用JSON看到此哈希元素:
"HG00112": {
"discordant_multiallelic_loss": 0,
"concordant_hom_alt": 4,
"discordant_het_to_alt": 0,
"discordant_hom_alt_to_ref": 0,
"discordant_hom_ref_to_alt": 0,
"lost_site": 0,
"concordant_het": 3,
"discordant_multiallelic_gain": 0,
"discordant_hom_alt_to_het": 0,
"discordant_call_to_no_call": 0,
"discordant_het_to_ref": 0,
"concordant_hom_ref": 5,
"concordant_site": 18,
"discordant_no_call_to_call": 0,
"concordant_no_call": 6,
"concordant_multiallelic": 0,
"gained_site": 0,
"discordant_hom_ref_to_het": 0
}
Run Code Online (Sandbox Code Playgroud)
我通常使用加载软件包use …
以下Perl 5脚本:
use strict;
use warnings;
use Data::Printer;
my @a = (1,2,3,4);
p @a;
Run Code Online (Sandbox Code Playgroud)
给出输出:
(注意蓝色),而这个Perl 6脚本:
use Data::Printer:from<Perl5>;
my @a = 1,2,3,4;
p @a;
Run Code Online (Sandbox Code Playgroud)
给出输出:
[
[0] 1,
[1] 2,
[2] 3,
[3] 4
]
Run Code Online (Sandbox Code Playgroud)
但数字没有着色(如上面的Perl 5案例).
系统信息:
$ perl --version
This is perl 5, version 29, subversion 3 (v5.29.3) built for x86_64-linux
$ perl6 -e '.say for $*DISTRO, $*VM, $*PERL.compiler.version'
ubuntu (18.10.Cosmic.Cuttlefish)
moar (2018.11)
v2018.11
Run Code Online (Sandbox Code Playgroud)