in reply to Subtracting values in two files

use autodie; open my $in1, '<', $file1; open my $in2, '<', $file2; open my $out, '>', $file3; for my $row ( 0..7 ) { my $line1 = <$in1>; chomp $line1; my @line1 = split / /, $line1; my $line2 = <$in2>; chomp $line2; my @line2 = split / /, $line2; my @out; for my $col ( 0..11 ) { push @out, $line1[$col] - $line2[$col]; } say { $out } join ' ', @out }

Since I want to use $col to index the line component arrays, it needs to be zero based. For symmetry, $row should also be zero-based. Otherwise, I would use 1..8 and 1..12, for clarity.

As Occam said: Entia non sunt multiplicanda praeter necessitatem.