in reply to Re: Two dimensional array
in thread Two dimensional array

I have the 2D array built from two arrays containg strings:
@temp_array = (\@arry1, \@arry2); my @exists = grep { $_->[0] eq $temp1 && $_->[1] eq $temp2} @temp_a +rray ;

Replies are listed 'Best First'.
Re^3: Two dimensional array
by shmem (Chancellor) on Oct 03, 2007 at 21:01 UTC
    Well, that changes things. Sticking to the row/column view, you have arrays of columns. Are those column arrays equal in element number?
    my @exists = grep { $temp_array[$_]->[0] eq $temp1 && $temp_array[$_]->[1] eq $temp2 } 0..$#{$temp_array[0]};

    The resulting @exists will contain the indexes into the two anonymous arrays your @temp_array holds where the comparison values are at the same index.

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}