in reply to how can I reboot a router

This isn't really a perl question, so there are probably better places to ask it other than here on Perlmonks. But I'll give it a swing.

Some cisco routers can be rebooted via an SNMP set of the propper OID. This will reboot a router that is on, but not turn on a router that is off.

I use X10 home automation gear at home to allow a perl program (using the ControlX10::CM11 module) to power-cycle my DSL modem when it needs it. This works well for a home environment, but I personally wouldn't use it in a datacenter.

Look into remote power control equiptment by vendors such as this. They are network addressable (protocol depends on product and vendor) and are designed to support remote reboots.