on tables
tables_arithmetic_operations.pl $inputFile1 $inputFile2 $inputArithmeticOperation3 $outputFile1
.. class:: infomark
**What it does**
This program implements arithmetic operations on tabular files data. The program takes three inputs:
- The first input is a TABULAR format file containing numbers only.
- The second input is a TABULAR format file containing numbers only.
- The third input is an arithmetic operation: +, -, x, or / for addition, subtraction, multiplication, or division, respectively.
- The output file is a TABULAR format file containing the result of implementing the arithmetic operation on both input files.
Notes:
- The two files must have the same number of columns and the same number of rows.
- The output file has the same number of columns and the same number of rows as each of the two input files.
- In case of division, none of the values in the second input file could be 0, otherwise the program will stop and report an error.
**Example**
Let us have the first input file as follows::
5 4 0
10 11 12
1 3 1
1 2 1
2 0 4
And the second input file as follows::
5 4 4
2 5 8
1 2 1
3 2 5
2 4 4
Running the program and choosing "Addition" as an arithmetic operation will give the following output::
10 8 4
12 16 20
2 5 2
4 4 6
4 4 8