Re: [問題] 關於 hash 的 sort
: 以下是我的寫法
: my $set1 = shift; #a.txt
: open FH1,$set1 or die;
: while (<FH1>){
: chomp;
: /^#/ and next;
: @_ = split /\t/;
: $test{$_[0]} = { contain => $_[1], total => $_[2], pvalue => $_[3] };
: }
: for ( values %test) {
: print "$_->{pvalue}\n";
: }
for ( sort{ $test{$a}{pvalue} <=> $test{$b}{pvalue} }(keys(%test) ){
print "$test{$_}->{pvalue}\n";
}
# 假設你是對pvalue排列 如果不是就對for迴圈裡取的hash做修改
--
如果青春注定要向前跑
他媽的...那我的出口在那?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.113.0.109
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):