Indeed, you will have to clear immigration and customs in Johannesburg. You will then have to recheck your bags and make your way to the domestic departure gates, but as you say you will already have your domestic boarding pass given to you in Perth. International and domestic terminals are connected to each other and less than 10 minutes apart (not separate terminals like in Perth).
Johannesburg is a pretty good airport for connections like this and you have more than enough time!
Perth is also one of the earlier arrivals so immigration and customs won't be too crowded by then!