use Text::Wrap;open(OUT,">jun2000.ranks.html") || die "Cannot open ranks for output";open(STAT,"jun2000.stats") || die "Cannot open stats for input";chomp(@stat=<STAT>);foreach (@stat) {($arc,$v1,$v2,$v3)=split;#print "$arc $v1 $v3\n";$items{$arc}=$v1;$hits{$arc}=$v3;}open(IN,"archives.html") || die "Cannot open econ.acct for input";chomp(@strings=<IN>);$str="";foreach(@strings) {   $str=$str." ".$_;}($lead,$rest)  = ($str =~ m!^(.+?)<\/TH><\/TR>(.+?)$!);($lead) =~ ($lead =~ s!several institutions.!several institutions.<p>An \"item hit\" is the retrieval of bibliographic information and the abstract of one archived \"item\": a single working paper, journal article or software component.<p>!);($lead) =~ ($lead =~ s!http:\/\/netec.mcc.ac.uk\/RePEc/!http:\/\/repec.org!);($lead) =~ ($lead =~ s!country!Archive Items!);($lead) =~ ($lead =~ s!Comments!Last Month's Item Hits!);print OUT wrap("","",$lead). "</TH></TR>\n";(@ar) = ($rest =~ m!<TR>(.+?)<\/TR>!ig);$nar=@ar;print "Nr archives: $nar \n";foreach (@ar) {$_ =~ s/<TD>//ig;($arch,$id,$c,$d) = split("<\/TD>",$_);$arcod{$arch}=$arch;$arid{$arch}=$id;}$aro=0;foreach $key (sort {$hits{$b} <=> $hits{$a} } keys %hits) { if($hits{$key}) {print OUT "<TR><TD>$arcod{$key}<\TD>$arid{$key}</TD> <TD><center>$items{$key}</center></TD><TD><center> $hits{$key}</center></TD></TR>\n"; $aro++;}}print OUT "</TABLE></BODY></HTML>\n";print "Nr nonzero: $aro \n";close(OUT);exit;