in reply to perl to add results of 2 arrays from 2 files together.

LanX has already given some good answers, so I'll just add that I'd advise against trying to do your own CSV handling. Use Text:CSV - it'll gracefully handle files that a naive approach WILL get wrong. Don't reinvent the wheel without a compelling reason.
  • Comment on Re: perl to add results of 2 arrays from 2 files together.

Replies are listed 'Best First'.
Re^2: perl to add results of 2 arrays from 2 files together.
by LanX (Saint) on Aug 26, 2014 at 15:50 UTC
    > I'd advise against trying to do your own CSV handling

    While "his" code tries kind of CSV handling (splitting on comma) his "data" doesn't have comma separation.

    I'd say he C&P-ed googled code¹ to pretend own efforts! :-|

    Cheers Rolf

    (addicted to the Perl Programming Language and ☆☆☆☆ :)

    ¹) at one point he also reads the fifth column and compares it with "Yes" ?!?

      While "his" code tries kind of CSV handling (splitting on comma) his "data" doesn't have comma separation.

      I'd say he C&P-ed googled code¹ to pretend own efforts! :-|

      Hmm, I don't think that's the case; he just didn't share his actual input data. I actually began coding a "clean" solution that he'd be able to use as a starting point, but stopped when I realized that there was no sample data to be found to test it against. Trying to reverse-engineer what it might look like would've been error-prone, and besides, like any good programmer, I'm lazy. (Which is not to say I'm a good programmer, mind you.)

      The data from INPUT and INPUT1 is just an example of output saved to a text file. you are quite right 'while INPUT1' i am doing a count on all unique values in 'column2' that have a 'YES' in 'column6'