#!/usr/perl/perl580/bin/perl opendir (DIR, "final"); chdir ("final"); while ($filename = readdir(DIR)) { if (($filename eq ".") || ($filename eq "..") || ($filename eq "kmeans_final3")) { next; } open (IN, "$filename") || die; my $firstline = ; # Skip the title line $i = 0; while(my $line = ) { $i++; } $number_of_patients_loop = $i; close(IN); open (IN, "$filename") || die; $iteration = ($number_of_patients_loop - 2); print ("Now working with $filename; this loop will iterate $iteration times\n"); @second_argument = ("50", "100", "200", "1000"); $index_of_number_of_clusters = 2; foreach $element (@second_argument) { $first_argument = $filename; $second_argument = $element; $third_argument = $number_of_patients_loop; while ($index_of_number_of_clusters <= $third_argument) { print ("Iteration $index_of_number_of_clusters\n"); system "perl -I/home/chicolobo/vetta/lib/site_perl/5.6.1/i386-linux kmeans_final3 $first_argument $second_argument $index_of_number_of_clusters"; $index_of_number_of_clusters++; } } }