in reply to Re: How to use multidimensional hashes
in thread How to use multidimensional hashes

I have two input files and I need to read each record from the file and need to count the number of A's, B's etc and if it repeated in other file, don't take the count and any help on this please

FILE_A 01|JAPAN|A| 01|CHINA|B| 01|CHINA|B| 01|MALY|C| 01|EUROPE|D|
FILE_A 01|JAPAN|A| 01|CHINA|B| 01|MALY|C| <p>output what i am expecting is</p> <code> FILE_NAME A B C D CHECK 1 2 1 1

Replies are listed 'Best First'.
Re^3: How to use multidimensional hashes
by x-lours (Sexton) on Jan 31, 2014 at 15:29 UTC

    if you count/sum only the A B C D ... it is normal to get

    FILE_NAME A B C D

    CHECK 2 3 2 1

    JAPAN A is in FILE_A and FILE_B so 2 times

    CHINA B is in FILE_A (twice) and FILE_B so 3 times

    MALY C is in FILE_A and FILE_B so 2 times

    if you don't want to count/sum after the first time, tou have to test the exists before.

      Hi,

      JAPAN A exists in FILE_A and FILE_B, so the count is 2 but i want JAPAN A to be displayed as 1 because it appears in both files

      Example:

      I want the output as:

      FILE NAME A B C D CHECK 1 2 1 1
        but i want
        It's not of much help to repeat what you want, but leave the information out what you are doing right now. Your code obviously has a bug if it doesn't do what you want it to do, but no one can find it without a look at what you are doing right now.