- #!/usr/bin/env perl
- use strict;
- use warnings;
- my @names = qw( no_ext exe dat cab EXE);
- my %hash;
- while (my $line1 = <DATA>) {
- my %tmp;
- my $line2 = <DATA>;
- @tmp{split /,/, $line1} = split /,/, $line2;
- for my $name (@names) {
- push @{$hash{$name}}, $tmp{$name} || 0;
- }
- }
- print join("\t\t", @names), "\n";
- foreach my $i (0..$#{$hash{$names[0]}}) {
- print join("\t\t", (map {$hash{$_}->[$i]} @names)), "\n";
- }
- __DATA__
- no_ext,jpg,swf,png,zip,xml,EXE,mp3,jsp,kprar,
- 12,2170772,148620,401807,98198,18612,8504,300,4,1,
- no_ext,dat,html,1 ,xml,php ,bin,
- 2337488,58234,27,9,4,1,1,
- no_ext,swf,jpg,xml,cab,
- 1459109,1832,2,3,1,
- no_ext,cab,ini,exe,png,zip,jpg,txt,z,7z,dd,ico,php ,
- 675,1333487,8949,52260,658,549,154,11,76,60,1,5,1,
- no_ext,fcg,xml,jpg,php,js,
- 22,1286870,4,1,2,1,
复制代码 |