sub get_counting_hash { my @wordArray = @_; my %wordHash; ## OK so you have an array. You'll need to loop over it. foreach my $word (@wordArray) { ## Now you need to populate the hash ## You assign a value to a hash like ## $wordHash{$key} = $value; ## so you'll need to adapt that to your code } return %wordHash; }