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!
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;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: local and global variable problem
by Athanasius (Archbishop) on Apr 30, 2014 at 15:59 UTC | |
by madM (Beadle) on Apr 30, 2014 at 16:04 UTC | |
Re: local and global variable problem
by thezip (Vicar) on Apr 30, 2014 at 15:59 UTC | |
Re: local and global variable problem
by Old_Gray_Bear (Bishop) on Apr 30, 2014 at 16:06 UTC | |
Re: local and global variable problem
by Bloodnok (Vicar) on Apr 30, 2014 at 16:04 UTC | |
Re: local and global variable problem
by Laurent_R (Canon) on Apr 30, 2014 at 22:33 UTC |
Back to
Seekers of Perl Wisdom