|Do you know where your variables are?|
Re: Unable to create HASH typeby roboticus (Chancellor)
|on May 07, 2018 at 11:10 UTC||Need Help??|
You're creating the hash value just fine. It's just that when you pass a hash to a function, it's expanding into a list. So when Dumper runs, it's dumping each value in the list separately, so it doesn't look like what you're expecting. Here's an example:
When run, it'll look like this:
So when you're going to use Dumper to display a hash, be sure to use a hash reference instead of letting the hash expand to a list of values.
You should be aware that the same thing happens with arrays: If you use Dumper on an array, you'll get $VAR=first array value, $VAR=second array value, etc., unless you use an array reference:
Update: Added bit about array/arrayref.
When your only tool is a hammer, all problems look like your thumb.