Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: array/hash - reference and dereferenceby fullermd (Priest) |
on Jan 09, 2009 at 03:04 UTC ( [id://735061]=note: print w/replies, xml ) | Need Help?? |
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".
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 Section
Seekers of Perl Wisdom
|
|