in reply to Index 2D Array

map or grep in scalar context return the number of elements. Scalar assignment enforces scalar context. Use parentheses for list context:
my ($result2) = map { $array[$_][0] =~ /goat/ ? $_ : () } 0..$#array; my ($result3) = grep { $array[$_][0] =~ /goat/ } 0..$#array;
or subscript the resulting list:
my $result2 = (map { $array[$_][0] =~ /goat/ ? $_ : () } 0..$#array)[0 +]; my $result3 = (grep { $array[$_][0] =~ /goat/ } 0..$#array)[0];

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]