in reply to Comparison of the row by using window size

Assuming your rows are compacted to strings:

my $row1 = pack 'C*', map 1+int( rand 2 ), 1..100; my $row2 = pack 'C*', map 1+int( rand 2 ), 1..100; substr( $row1, $_, 10 ) eq substr( $row2, $_, 10 ) and print "Found match at offset; $_" for 0 .. length( $row1 ) - 10;

Replies are listed 'Best First'.
Re^2: Comparison of the row by using window size
by snape (Pilgrim) on Jan 27, 2010 at 14:43 UTC

    Hi Browser,

    Can you please explain me the code and difference between the two lines as both of the same seems to be the same statement:

    my $row1 = pack 'C*', map 1+int( rand 2 ), 1..100; my $row2 = pack 'C*', map 1+int( rand 2 ), 1..100;

    Thanks.

      The first line is $row1 and the second line is $row2.
      Its building two different random strings for the algorithm to search through.