To count only array refs inside an array ref, you can use grep together with the ref built-in. Assuming there can be other things as well as array refs inside your outer array ref, you can do it like this:
my @array = (["a","b","c"],[1,2,3],["q","w","e"], 4);
my $count = scalar grep { ref $_ eq 'ARRAY' } @array;
print $count;
__END__
3
It will look at each element of @array in turn, grab the ones that have a ref type of ARRAY and force the resulting list to scalar context, giving the number of elements.
Since you seem to have an hash ref that holds array refs with array refs, maybe changing it to this will do the trick. I assumed you could do the transfer yourself.
my $count = scalar grep { ref $_ eq 'ARRAY' } @{ $hashref->{element} };
print scalar(@array)give you? I think the answer is 9 because the 'sub-arrays' don't exist -- they've been flattened into one array. You'd need to use array references to get sub-arrays, with square brackets around the sub-arrays.ARRAY(0xfoo)you do not have what you are saying you have in your question. Please show real code, or if it's from a hash(ref) as said in a comment on an answer, please show real debug output.scalar(ARRAY(0x80872ec))is nothing like what Perl 5.18.1 gives -- it gives 9.print scalar(@array)is not yielding 3 in the amended code, you might need to show us whatuse Data::Dumper;andprint Dumper(\@array);prints.