Perl has a feature called context which is either absolutely brilliant or unbelievably annoying. It now happens that a hash variable used in list context evaluates to a flat list of keys and values, e.g. %hash = (Index => 1, Text => "Text1") might produce the list
'Text', 'Text1', 'Index', 1
Each of those items is then pushed onto the array. There is also scalar context which tells us how many “buckets” in the hash are being used. But how can we push the hash onto the array?
We don't. For certain reasons a collection can't have another collection as a value. Instead we must use a reference, which we can obtain with the \ operator (a reference is like a pointer, but safer). We can push that hash reference onto the array:
push @worte, \%wortObj;
Now when we loop over the items in that array, they aren't hashes – they are references to hashes. Therefore before accessing fields in the “hashref”, we have to dereference them first. One way to do that is to use the -> operator, and we get:
for my $wortObj (@worte) {
print "$wortObj->{Index} $wortObj->{Text}\n";
}
For more info on references, start with perlreftut, then maybe read perlref, perldsc, and perlootut.