Your Rod and Staff they Comfort Me

I used to struggle with the idea of a rod and staff being of comfort, as we read in the 23rd psalm.

The only rod I had known as I was growing up was a rod which was used to punish me when I was naughty (I think that was quite often and it was allowed in those days) A staff was probably something else I associated with punishment. How could they comfort me?

After some research I now know that the rod was used by shepherds to count the sheep as they passed under it and the staff was used to drive away wild animals. So I can now say ‘ Your rod and staff, they comfort me.’ Thanks be to God.