[LON-CAPA-cvs] cvs: modules /gerd/educause correl.pl

www lon-capa-cvs@mail.lon-capa.org
Mon, 22 Mar 2004 14:26:51 -0000


www		Mon Mar 22 09:26:51 2004 EDT

  Added files:                 
    /modules/gerd/educause	correl.pl 
  Log:
  Little program to extract correlations
  
  

Index: modules/gerd/educause/correl.pl
+++ modules/gerd/educause/correl.pl
%res=();
$questionaire=0;
open(IN,'results.csv') || die('Could not open file');
while($line=<IN>) {
    $questionaire++;
    print "\n$questionaire ";
    chomp($line);
    @entries=split(/\,/,','.$line);
    for ($first=1;$first<=$#entries;$first++) {
	print ".";
	unless ($entries[$first]) { next; }
	$key=$first.':'.$entries[$first].'_';
	for ($second=1;$second<=$#entries;$second++) {
	    if ($first==$second) { next; }
	    unless ($entries[$second]) { next; }
	    $res{$key.$second.':'.$entries[$second]}++;
	}
    }
}
close(IN);
print "\nSorting\n";
foreach (sort { $res{$a}<=>$res{$b} } keys %res) {
    print $_.' '.$res{$_}."\n";
}