in reply to adding a new hash in an array
Your basic problem is that you are running without use strict; with it, you would realize that the code
does not do what you think it does.{ my %row; }
You need to put the my outside of the loop, and instead of simply assigning new values to the hash, you need to make sure each row gets it's own anonymous hash.
The way I usualy do it looks somewhat like this:
Actually, I usualy fill in the values right when I allocate the anonymous hash, but that couldn't be translated into what you need as easily.foreach (@rows) { push(@arr,{}); $cnt++; # .... code ... $arr[$cnt]{somestring}=$somevalue; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: adding a new hash in an array
by popsin (Initiate) on Jul 14, 2004 at 20:34 UTC | |
by friedo (Prior) on Jul 15, 2004 at 00:06 UTC |