It'll create a one element hash, whose key is the empty string, with an undefined value.$ perl -wle '%hash = undef; print scalar %hash' Odd number of elements in hash assignment at -e line 1. Use of uninitialized value in list assignment at -e line 1. 1/8
The last three solutions modify the hash while iterating over the keys, which should be a no-no. However, I just read that in the documentation of 'each' that deleting the item most recently returned by 'each()' is safe; this feature seems to have been added (or documented) in 5.6.1.
Abigail
In reply to Re: OT: clearing a hash (was: TIMTOWTDI doesn't mean invent an outlandish approach (usually))
by Abigail-II
in thread TIMTOWTDI doesn't mean invent an outlandish approach (usually)
by davido
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |