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

Hi Monks!

Im trying to make a calculation inside a loop and work with the results after the loop has ended. In this example im creating an array (@matrix_numbers) with all values of the hash of hashes( $matrix->{$key}->{$key2}). As it is a problem with global and local variables i dont think is important to describe whats inside those variables.
When i try to print the array after the loop has ended im getting nothing.. the array is empty..
any ideas why is this happening and how can i avoid this?
thank you all!
foreach my $key (@aminos){ #used to create an array with all values of + the matrix foreach my $key2 (@aminos){ @matrix_numbers = $matrix->{$key}->{$key2}; } } print @matrix_numbers;