Sun751 has asked for the wisdom of the Perl Monks concerning the following question:

I have and array @ABC where each element is a hash, can some one suggest me if I want to find out number of hash key in last array element how can I do that?
I know that I can access the hash key of last array element through $name = $ABC::ABC-1->{'Name'}
Any suggestion?Please
Cheers

Replies are listed 'Best First'.
Re: Number of key in Array of hash
by roubi (Hermit) on Jul 23, 2009 at 00:29 UTC
    my @array; ... my $key_count = keys %{$array[-1]};
Re: Number of key in Array of hash
by Anonymous Monk on Jul 23, 2009 at 00:37 UTC
Re: Number of key in Array of hash
by susanti13 (Novice) on Jul 23, 2009 at 01:05 UTC
    my $lastIndex = (scalar @ABC) - 1; my $totalKeys = scalar keys %{$ABC[$lastIndex]};
      All these are equivalent
      my $totalKeys = scalar keys %{$ABC[-1]}; my $totalKeys = keys %{$ABC[-1]}; my $totalKeys = 0 + keys %{$ABC[-1]};