no21 has asked for the wisdom of the Perl Monks concerning the following question:
=================================### $html contains contents of a file while($html =~ <some regex here>){ $player{'gp'}=$1; $player{'min'}=$2; $player{'fgm'}=$3; $player{'fga'}=$4; $player{'fgp'}=$5; $player{'tpm'}=$6; $player{'tpa'}=$7; $player{'tpp'}=$8; push (@players, \%player); $html=$'; } ###Once I get here, every hash ref in the array points to ###the same +hash (the last one to be pushed onto the array. ###Each of the follo +wing lines then prints out ###the same data. print "Size of \@players: ".$#players." Element 0 is: $players[0]{ +'min'} "."\n"; print "Size of \@players: ".$#players." Element 1 is: $players[1]{ +'min'} "."\n"; print "Size of \@players: ".$#players." Element 2 is: $players\[2\ +]{'min'} "."\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Array of Hashes question
by pg (Canon) on Oct 30, 2004 at 05:52 UTC | |
by no21 (Sexton) on Oct 30, 2004 at 12:52 UTC | |
|
Re: Array of Hashes question
by bobf (Monsignor) on Oct 30, 2004 at 06:10 UTC |