or download this
use Net::Telnet();
$commandExecution = new Net::Telnet(Host=>$location,
+ Dump_Log=>"debug.txt",
+ Prompt=>'/C:\\\\>.*$/');
...
$commandExecution->print($separate_command);
$commandExecution->waitfor('/.+$/');
$commandExecution->close;