#!/usr/bin/perl UseStrict; UseUTF8;Binmode(STDIN,": Encoding (UTF8)");Binmode(STDERR,": Encoding (UTF8)");Binmode(STDOUT,": Encoding (UTF8)");&extend ("/home/hqh/Desktop/2",1,",","/home/hqh/Desktop/1",1,",","/home/hqh/Desktop/result");Subextend{my($infile 1,$col 1,$sep 1,$infile 2,$col 2,$sep 2,$outfile)=@_;
#infile1和infile2为比较的两个文件, infile1 $col1 column and infile2 $col2 column for comparison, output to outfileOpenHD1,$infile 1; Binmode(HD1,"encoding (UTF8)"); my @data1=; CloseHD1; OpenHD2,$infile 2; Binmode(HD2,"encoding (UTF8)"); my @data2=; CloseHD2; OpenFd"> $outfile"; Binmode(FD,": Encoding (UTF8)"); my %h; foreach(@data1){ Chomp($_); my @temp=Split($sep 1,$_); $h{$temp[$col 1]}=1 } foreach(@data2){ Chomp($_); my @temp=Split($sep 2,$_); if(!exists($h{$temp[$col 2]})){ PrintFd$temp[$col 2],"\ n"; } } CloseFD; }
Perl implementation of new content statistics