pl统计小程序a

来源:互联网 发布:数据提供商 编辑:程序博客网 时间:2024/06/14 20:51
!#/usr/bin/perl


@instr_names=();
@instr_pctg=();


@instr_names=qw/"movei8","strmgi16","strmovei16","add1","kill2","movestri8"/;
@instr_pctg=(0.3,0.2,0.1,0.1,0.1,0.1,0.1);


%tot_pctg_len=();


for($cur=0;$cur<@instr_names;$cur++){
if($instr_names[cur] =~ /(\d+)/){
$tmp_digit=$1;
$tot_pctg_len{$tmp_digit}+=$instr_pctg[cur];
}
}


while(($key,$value)=each %tot_pctg_len){
print "$key -> $value\n";
}
0 0
原创粉丝点击