in reply to combining two csv files by using math operations

I recommend three things:

  1. Fix your compilation errors
  2. Fix your runtime errors
  3. Fix your logic errors

I could give more specific help if you would give a more specific problem statement than "I do not seem to accomplish that."

When I try to run your code under Perl 5.32.1 I get

Experimental push on scalar is now forbidden at fubar.new line 32, nea +r "$avgX )" Experimental push on scalar is now forbidden at fubar.new line 33, nea +r "$avgY )" Experimental push on scalar is now forbidden at fubar.new line 34, nea +r "$avgZ )" Experimental push on scalar is now forbidden at fubar.new line 35, nea +r "$difF )" Execution of fubar.new aborted due to compilation errors.
Is this what you are seeing? A different version of Perl might actually compile this, in which case it is on to the next problem.