use strict; use Expect; my $timeout = 10; my $command = 'telnet'; my $params = ("10.123.125.13"); # Create the Expect object my $exp = Expect->spawn($command, $params) or die "Cannot spawn sftp command \n"; $exp->expect($timeout, ["mpp>"]); $exp->send("enable\n"); $exp->expect($timeout, ["mpp#"]); $exp->send("help\n"); # Help gives list of available commands $exp->expect($timeout, ["mpp#"]); $exp->send("exit\n"); $exp->send("logout\n"); $exp->soft_close();