in reply to Re: comparing array elements
in thread comparing array elements

Hi Abigail-II, the problem is that intersection works on the whole list, I need to work on individual elements in the same position.

Replies are listed 'Best First'.
Re: comparing array elements
by Abigail-II (Bishop) on Nov 21, 2003 at 09:40 UTC
    At first, I thought that too. But then you were considering to use a hash.

    What have you tried so far?

    Abigail

      the hash backfired! so i'm using a for loop. (little success so far) my comparison operator isn't working (both arrays contain 4- letter words) and i just need to determine which words are contained in the same position in each array.

      thanks for helping!

      for (my $i =0; $i < @forward_tets; $i++) { if ($forward_tets[$i] =~ $reverse_tets[$i]) { print "$forward_tets[$i] \t $reverse_tets[$i]\n" +; } }
        To compare two strings for equality, one uses eq, not =~ (although, if the words just contain letters, it would work too).

        Abigail