in reply to Re: rebuilding hashes
in thread rebuilding hashes
I wrote a note above that goes over why I'm not using an array. This hash in reality isn't being used, this is a test script I setup to see if it would work. I'm actually tying this hash to SDBM and sorting by numbered keys has never been a problem for me using for (grep defined($_), (sort { $a <=> $b } keys %code).0 ==== zero 1 ==== one 2 ==== three 3 ==== four
The reason I need to rebuild the hash is because in the admin panel, when they remove a key/value, the user is returned to a menu with back and foward buttons that lets them scroll the data. For the forward button, I increment the key value by one, and the opposite for the back button. BUT, if we have keys 1, 2, 3, 4, 5 and they remove 3, the navigation buttons crash between two and four because it loads 3 which doesn't exist.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: rebuilding hashes
by duff (Parson) on Feb 02, 2004 at 20:36 UTC | |
|
Re: Re: Re: rebuilding hashes
by stvn (Monsignor) on Feb 02, 2004 at 21:02 UTC | |
|
Re: Re: Re: rebuilding hashes
by ysth (Canon) on Feb 02, 2004 at 21:36 UTC |