Every person who swears or affirms falsely in any matter is guilty of perjury in the second degree. Every person who testifies falsely after being duly sworn or having affirmed as a witness in any proceeding provided for in sections 37-85-103 to 37-85-106 is guilty of perjury in the first degree and, upon conviction thereof, shall be punished accordingly.