This depends platform to platform I imagine. Under Linux there is the 'setleds' command (man setleds). You could wrap a system call around that. As for doing it purely in Perl, I don't know of a way.
HTH
/\/\averick
perl -l -e "eval pack('h*','072796e6470272f2c5f2c5166756279636b672');"