It doesn't work because the scalar $dat you've declared has nothing to do with the hash %dat. Hashes and scalars (and arrays for that matter) have completely different namespaces. $a, @a, %a all can exist simultaneously and are completely disjoint from one another. You need to (re-)read perldoc perldata.
In reply to Re^2: Passing Hashes
by Fletch
in thread Passing Hashes
by ironcom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |