I'm trying to create an array of arrays using array references. I think I've
narrowed the problem down. When I attempt to print out the array of arrays,
I get the same data for each array reference. I printed out all of the
reference numbers to arrays and they were all the same.
Maybe my code will help explain:
foreach my $file (@homes) { open(HOUSE, "<$base_directory/homes/$file") || die &show_error("Unab +le to open file in sort routine"); @home = <HOUSE>; close(HOUSE); # create array of arrays chomp(@home); push @sorted, \@home; }
When I print the references stored in the array, i get ARRAY(0x8108f20) ARRAY(0x8108f20) ARRAY(0x8108f20). How do I get this code to create different array references, so that when I go to use the data, I get different information each time through. Basically, N different array references based on what is read in from "$file". Hope this makes sense.
Edit ar0n -- wrapped code in code tags
In reply to help with array of arrays by emilford
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |