hotshot has asked for the wisdom of the Perl Monks concerning the following question:
Hi guys !
A simple one. How can I convert an array of n elements to a hash with those n elements as keys? (the values are not important to me).
Second one. I have to run on the above hash as follows:
while (1) { for $key (keys(%myhash)) { if (&isPassTest()) { delete($key); } } }
like that I run on a decresing hash %myhashtill every element passes the test and the hash is empty. Will it work or removing elements while running on the hash can cause problems of some sort?
Thanks.
Edited: ~Wed Jul 24 15:26:45 2002 (GMT) by footpad: Added missing </code> tag
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: converting ana array to a hash
by broquaint (Abbot) on Jul 24, 2002 at 13:17 UTC | |
|
Re: converting ana array to a hash
by jmcnamara (Monsignor) on Jul 24, 2002 at 13:26 UTC | |
|
Re: converting ana array to a hash
by giulienk (Curate) on Jul 24, 2002 at 13:19 UTC | |
|
Re: converting ana array to a hash
by simeon2000 (Monk) on Jul 24, 2002 at 13:22 UTC |