圆月山庄资源网 Design By www.vgjia.com
复制代码 代码如下:
#!/usr/bin/perl
#use strict;
open(FILE1,"C:/Perl/BX/BX-Users.csv");
open(FILE2,"C:/Perl/BX/BX-Books.csv");
open(FILE3,"C:/Perl/BX/BX-Book-Ratings.csv");

open(result1,">C:/Perl/BX/BX-Users.txt");
my %table;
my $record1;
my $count1;
#my $i=0;
<FILE1>;
while($_=<FILE1>)
{
    if($_ =~ /NULL$/){
        next
    }
    else{
    s/"//g;
    my @list=split /;/,$_;
    #print"@list";
    push @{$table{$list[0]}},$list[2];
    #print "$record1";
    #$i++;
    }
}
foreach my $userId(sort keys %table)
{
    my @AGE=@{$table{$userId}};
    syswrite(result1,"$userId,@AGE");
    $count1++;
}
print "$count1";
close(FILE1);
close(result1);

close(FILE2);
close(FILE3);
标签:
perl,csv

圆月山庄资源网 Design By www.vgjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
圆月山庄资源网 Design By www.vgjia.com