in reply to Two dimensional array
@temp_array is two dimensional.How do you construct your array?
If your array is an array of rows, each row containing two columns, it should be something like
@array = ( [ 1, 2 ], [ 3, 4 ], [ 2, 5 ], );
Now, if you want to find the row that contains the values 3, 4
$temp = 3; $temp_1 = 4; @matching_rows = grep { $_->[0] == $temp && $_->[1] == $temp_1 } @arra +y;
With the above @array the resulting array consists of one element, which is an anonymous array containing the values 3 and 4. See perlref and perlreftut for the [ ] constructor.
--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}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Two dimensional array
by Anonymous Monk on Oct 03, 2007 at 20:46 UTC | |
by shmem (Chancellor) on Oct 03, 2007 at 21:01 UTC |