Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: combining two csv files by using math operations

by 1nickt (Abbot)
on May 16, 2021 at 12:06 UTC ( #11132658=note: print w/replies, xml ) Need Help??


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

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.

Replies are listed 'Best First'.
Re^4: combining two csv files by using math operations
by ng0177 (Acolyte) on May 16, 2021 at 12:37 UTC
    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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11132658]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2021-10-16 17:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (69 votes). Check out past polls.

    Notices?