On Mon, 18 Jun 2001, Peter Cornelius wrote:
> > Wait a sec, brain cramp....
> > Wouldn't that:
> > 1) just access $hash{$key}
> > 2) increment $key
> > 3) add $hash{$key + 1}
>
> I realize this is getting away from the original post, but I'm confused by
> #3 here. Wouldn't it just do 1 and 2? Would it actually access the hash
> twice?
It would access the value retrieved by $key, then add 1 to $key, then
create another entry in the hash table for $key + 1, unless it exists
already. Doing ++$key would only do #2 and #3. Note this only works if
$key is a number, and if you are using numbers as hash keys, why not just
use an array?
-- Brett
http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
"I'm willing to sacrifice anything for this cause, even other people's lives."