in reply to Re: combining two csv files by using math operations
in thread combining two csv files by using math operations

Thanks. The sample data is under __dataA__ and __dataB__ I am not sure how to best avoid opening files when the data exists. The input format is floats, the output is supposed to be scientific format.
  • Comment on Re^2: combining two csv files by using math operations

Replies are listed 'Best First'.
Re^3: combining two csv files by using math operations
by 1nickt (Canon) on May 16, 2021 at 12:06 UTC

    Hi again,

    Forgive me but I don't know what "scientific format" is. Please show the expected output from the sample data.

    $ perl -Mstrict -wE 'my $avg = (1.10000E0 + 3.10000E0) / 2.; say sprin +tf("%E", $avg)' 2.100000E+00
    ?


    The way forward always starts with a minimal test.
      Sorry, my fault. See amended as above.

        And instead you got ... ?

        Still seems to work as expected with a one-line SSCCE.

        $ perl -Mstrict -wE 'my $avg = (1.0 + 3.0) / 2.; say sprintf("%E", $av +g)' 2.000000E+00
        Try taking the file ops out of the equation, and add some debugging during the flow to see that your variables contain what you think they do.

        Hope this helps!


        The way forward always starts with a minimal test.