in reply to hash array

The actual problem is that you're alternating between a hash and hashref. You create a hash, %dictionary. But when you try to access it as $dictionary->{$key}, you're treating it as a hashref called $dictionary, which doesn't exist. I suspect that if you used strict and warnings, there would be complaints. Use $dictionary{$key} instead, treating it as a hash, and it'll work.

There's also a stylistic problem, in that you're passing a hashref to your sub and not using it. That doesn't break your program, because defining the variable with my makes it local to the file, including the subs. So you can access %dictionary within your subs without passing it as an argument, but if you're going to do that, you should remove the argument from the subroutine call, because it makes it look like you forgot something.

Aaron B.
My Woefully Neglected Blog, where I occasionally mention Perl.