in reply to compare columns in all possible combination

Hello mate,
please describe in plain steps
how exactly works the algorithm for receiving the desired output.

update
check if this what you want
use Inline::Files; push @b, [split ' '] for <FILEB>; while (@a = split ' ', <FILEA>){ --$_ for @a; print "@{$b[0]}[@a]\n"; for $i (1.. $#b) { undef @h{@{$b[$i]}[@a]}; $s++ if scalar keys %h == 1; undef %h; } print "$s\n" if $s; undef $s; } __FILEA__ 1 2 3 4 1 2 3 5 1 2 4 5 1 3 4 5 2 3 4 5 __FILEB__ A B C D E 0 0 0 + 0 + 0 + + + 0 + + + + 0 0 + + 0 + + + + + 0 + + + + + 0 + + 0

Replies are listed 'Best First'.
Re^2: compare columns in all possible combination
by greeknlatin (Initiate) on Sep 21, 2014 at 10:01 UTC

    Hello! sorry for late reply.

    Algorithm include following steps:

    1. accessing each line of file 2

    2.and parsing these elements to while loop(so on accessing the respective columns)

    3.comparing those columns in for loop

      No, I meant
      how does every line like 1 2 3 4
      relate to the file1 ?
      We take only 1 2 3 4 columns from file1?
      A B C D? what is the logic we're trying to achieve at the end?
      To summarize the column's pluses and zeroes in different arrays?
      Maybe it is an XY problem we're facing here.
      At this point I got this:
      we take the first line 1 2 3 4, decrement every element,
      then in a loop we push 4 elements into different four arrays according to these values.
      At the end we're getting four arrays that look like this:
      A0+000+0A0+000+0A0+000+0A0+000+0A0+000+0.
      So what's the end goal?

        lines in file 2 contains all possible combinations of columns in file 1.

        By this way I am trying to calculate the no. of rows of any three or four columns are equal with each other.