in reply to Hash key counting
If you start off with %column = ( 2 => 1 ); then you'll just keep doing $column{2}= 1 over and over.
This seems like a case where you would want to use push on an array instead. (That is, unless you are planning on deleting things from the middle, in which case you don't want to use 1+number_of_keys as the next column number.) Or since you are only ever putting 1 in, you could simply have a scalar $max_column_number that you increment.
Even after reading 3 explanations from you about this code, I still don't see why you want to put data into a hash in this manner. How do you use this hash elsewhere?
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Hash key counting (2=>1)
by agentv (Friar) on Apr 21, 2003 at 23:33 UTC | |
by dragonchild (Archbishop) on Apr 21, 2003 at 23:37 UTC | |
by Aristotle (Chancellor) on Apr 22, 2003 at 00:03 UTC |