An off topic non perl solution, people use home assistant to automate all sorts of 'smart' home devices, one example from their community forum on this subject.
In reply to Re: Controlling USB on Raspberry Pi
by marto
in thread Controlling USB on Raspberry Pi
by Bod
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |