I'm confused on just what you're trying to do. I'm not sure you aren't as well.
# How to create a hash with keys only?
That's nonsensical. Keys are a way to find a value. You can create a hash of keys whose value is undef or 0 or an empty string or any temporary placeholder you want, but you can't have a "hash with keys only".
@insert = \%hash;
This creates a 1-array whose first element is a reference to an empty hash. I don't think that's what you want to do.
The rest of the code is at least superficially reasonable (if you put %ages before the lines where you try and reference it), but what's the purpose of %hash? What are you wanting to end up with?
In reply to Re: array/hash - reference and dereference
by fullermd
in thread array/hash - reference and dereference
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |