- 论坛徽章:
- 0
|
回复 11# 芙蓉女侠
是这样就好了。。。关键不在这。。。。
我改成my $rootDir =$ARGV[0];
my $date = $ARGV[1];
my $csvDir = $rootDir . $date ."/csv/";
my $output1 = $rootDir . $date . "/fielname_url_row.csv";
my $output2 = $rootDir . $date . "/url.csv";
my $chongfu = $rootDir . $date . "/chongfu.csv";
my @srcFiles = ();
find sub {push @srcFiles ,$File::Find::name if -f $_ && /\.csv$/i},$csvDir;
my $row = 0;
foreach my $csvFile(@srcFiles){
print "$csvFile\n";
$row++;
my @lines = loadIgnoreTitle($csvFile);
open RR, ">$output1";
foreach my $line(@lines){
my @fields = split(/,/,$line);
my $url = $fields[6];
print RR $url . "\n" ;
}
close RR;
open RH, ">$chongfu";
my @urls = loadContainTitle($output1);
my %count = ();
my @chongfu = grep{++$count{$_} > 1 } @urls;
my %uniqchongfu = map{$_ ,1}@chongfu;
my @chongfu2 = keys %uniqchongfu;
foreach my $line2(@chongfu2){
print RH $csvFile . $line2 . $row . "\n";
}
close RH ;
}
输出到重复的文件夹没有内容,之前也碰见过类似的问题,就是用简单的例子做试验,可以。。。可是一到工作中,具体到文件里面,就不知道哪出错了,我感觉问题就在数组那,我再看看 |
|