Time1 1 2 3 Time 2 4 5 6 #### use 5.10.0; use warnings; my $output = "results.txt"; my ($fh1, $fh2, $fh3, $fh4, $fh5); my ($file1, $file2) = @ARGV; my (@col1, @col2, @col3); my ($lines, $lines2, $lines3); my (@array, @array2) = (); my @diff = (); my $csv = "csv.csv"; ###Open files for read and write### open ($fh1, '<', $file1) or die $!; open ($fh2, '+<', $file2) or die $!; open ($fh3, '>', $output) or die $!; #open my $out, ">", "out.csv" or die $!; ###Reads lines from file into an array### while ($lines = <$fh1>){ chomp $lines;#Removes the new line @col = split "," , $lines; #Array where each index holds the data of each column push @array, $col[5]; #adding element to the array containing slack values for file } shift @array;#Removes the header line from the array -i.e column name ###Reads lines from file into an array### while ($lines2 = <$fh2>){ print $fh4 $lines2; chomp $lines2; #push @list, $lines2; @col2 = split "," , $lines2; push @arr, @col2; push @array2, $col2[5]; } shift @array2; ###Iterates through the array and finds the difference in slack### foreach my $i (@array){ $diffs = $array2[$i] - $array[$i];#Variable showing difference push @diff, $diffs;#Adding element to an array containing the difference values } ###Prints out the 2 differenct slacks from each run and shows the difference between them. #print $fh3 "Difference :", $array[$_] ,"-", $array2[$_], " = ", $diff[$_], "\n" for 1 .. $#array; unshift @diff, "Difference";