good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: hash arrayby repellent (Priest) |
on Mar 11, 2012 at 22:59 UTC ( [id://959045]=note: print w/replies, xml ) | Need Help?? |
%dictionary is a hash. You are passing it as a hash reference argument to readWords() and sortDictionary(), via \%dictionary. So far so good. Now, inside the functions readWords() and sortDictionary(), you need to consume the argument you passed in. But your code currently does not do that. (Instead, it is consuming the closed-over lexical my %dictionary - if you don't understand this last sentence, ignore it for now). Let change your functions to consume the passed in hashref. To avoid confusion, I renamed the variable inside the functions to be $dict instead. Here's the same code with modifications indicated:
In Section
Seekers of Perl Wisdom
|
|