Just to add to what Zaxo said, you'll probably want to use an explicit aliasing variable in your 'for' loops instead of $_ for clarities sake. Something like this:
foreach my $hash (@a) {
foreach my $word (keys %$hash) {
my $wordvalue = $hash->{$word};
# ...
}
}
Notice that because $hash is a reference to a hash you access its elements via
->{}.
In general if you are going to iterate through an array, you want to use 'foreach's aliasing ability to access the elements of the array directly instead of accessing the elements through their indexes.