#!/usr/bin/perl # ARGV[0] is the input file name (first parameter) #print $ARGV[0]; open(MYF, "<$ARGV[0]"); @lines = ; close(MYF); $values = ""; $summations = ""; foreach my $line (@lines) { @values2 = split(/\,/, $line); $sum = 0; $val = 0; foreach my $val (@values2) { #print $val; #print "val is $val\n"; $sum = $sum+$val; } #print "sum: $sum\n"; # First check to see if the summation is not already in the list. $no_go = 0; foreach my $pre (@summations) { if ($pre == $sum) { $no_go = 1; } } if (!$no_go) { push(@summations,$sum); } } @s = sort @summations; #{$b <=> $summations} @summations; for ($i = 0; $i < 50; $i++) { print "Value: " . $s[$i] . "\n"; # Which graph ID is this associated with? $j = 0; foreach my $line (@lines) { @values2 = split(/\,/, $line); $sum = 0; $val = 0; foreach my $val (@values2) { $sum = $sum+$val; } if($sum == $s[$i]) { if ($j < 10) { print "\tcandidates00$j.dsm\n"; } elsif ($j < 100) { print "\tcandidates0$j.dsm\n"; } else { print "\tcandidates$j.dsm\n"; } } $j++; } }