in reply to Printing a hash from a foreach loop

Common and easy mistake.. you're going through each element in your foreach so you're getting both the keys and the values, as if it were an array rather than a hash.

To fix it simply change it to foreach $day (keys %days_in_month. This will only get the keys.

  • Comment on Re: dumb newbie question about hashes and printing from a foreach loop
  • Download Code