In the referee's defence - there are times in our climate where it is necessary for officials to wear caps otherwise it would be impossible. It's not unusual for me to have a rolled up cap tucked in the back of my shorts when AR at certain grounds with later kick offs, although I only use it when absolutely necessary as I don't feel it looks the most professional.
A 2:45 KO, in June/July could give me and hour and a half of full sun in my eyes, resulting in missed calls/offsides and a blinding headache.
Granted, it would be extremely unusual for the ref to wear a cap, but we do have a couple of guys who use sports-safe sunglasses when on the whistle.