in reply to Array of Hashes question
Put your "my %player;" inside the while loop. Try with the following code, then uncomment that "my %player;" outside the loop, comment out the inside one and try again.
use Data::Dumper; use strict; use warnings; my @players; #my %player; for my $index (1 .. 10){ my %player; $player{'a'}=$index; push (@players, \%player); } print Dumper(\@players);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Array of Hashes question
by no21 (Sexton) on Oct 30, 2004 at 12:52 UTC |