in reply to Index 2D Array

Your current data structure makes this search harder than it needs to be.
Simple, easy-to-read code to work with this:
my @a2=map { $array[$_][0] } 0..$#array; my ($goat_idx) = grep{ $a2[$_] eq "goat" } 0..$#a2; print "Goat index is $goat_idx.\n";
(Output is : Goat index is 2.) It will be "undef" if "goat" is not found.

                "If you had better tools, you could more effectively demonstrate your total incompetence."