If I remember correctly, http://geck.gamesas.com/index.php/HasPerk will report a perk's rank if called in the console, but there is no way to access this information via a script. Your best bet would be to trigger some other detectable event, like the incrementation of a global variable, so that you can detect the perk's rank indirectly.