Hashes require an even amount of elements. The first of each pair is the key and the second is that key's value. So warnings would tell you your %verbs
hash contains an odd amount of elements. Take a look at perldata
. I think what you are looking for are simple arrays, and getting random combinations of two arrays via rand
. Something like this should work:
my @pronouns = qw/He She I Me/;
my @verbs = qw /jumped ate laughed cheated/;
print $pronouns[rand @pronouns] .
' ' .
$verbs[rand @verbs] . $/;