Hi everyone!
So here's my problem:

Given an element, I need to get the index of the array in an array of arrays.

For example, I have the following array of arrays:

my @arrOfArr = (
           [ "1023", "1472", "0751651"],
           [ "1527", "1167", "2496111" ],
           [ "M167", "1412", "1761683" ],
		  );

Is there any way that when I know the value "1527", I will know its index in the arrays of arrays which is '1'?

Thus:
'1023' is at index 0;
'1527' is at index 1;
'M167' is at index 2;

If my question was not clear, I would be glad to answer any clarifications.
TIA.

Is there any way that when I know the value "1527"

use strict;
use warnings;

my @arrOfArr = (
           [ "1023", "1472", "0751651"],
           [ "1527", "1167", "2496111" ],
           [ "M167", "1412", "1761683" ],
		  );

my $data = '1527';
my $flag = 0;

for my $i ( 0 .. $#arrOfArr)
{
	for my $j ( 0 .. $#{$arrOfArr[$i]})
	{
		if ( $arrOfArr[$i][$j] eq "$data")
		{
			print "\n$data found at \$arrOfArr[$i][$j]";
			$flag = 1;
		}
	}
}

print "\n$data not found in the array" if (!$flag);
This question has already been answered. Start a new discussion instead.