今天写了两个小程序处理excel文件:

#!/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);

 

相关文章:

  • 2021-09-26
  • 2022-01-30
  • 2021-05-30
  • 2021-12-25
  • 2021-09-02
  • 2022-12-23
  • 2021-07-01
  • 2021-11-16
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-06
  • 2022-12-23
  • 2022-01-23
  • 2021-11-19
相关资源
相似解决方案