# Starting ssh without password # 1) run the constructor my $ssh = Net::SSH::Expect->new ( host => "10.0.0.1", user => 'testuser', raw_pty => 1 ); # 2) now start the ssh process $ssh->run_ssh() or die "SSH process couldn't start: $!"; # 3) you should be logged on now. Test if remote prompt is received: ($ssh->read_all(2) =~ />\s*\z/) or die "where's the remote prompt?" $ssh->exec("terminal width 512"); $ssh->exec("terminal length 0"); my @output = $ssh->exec("show ip accounting"); my @output1 = $ssh->exec("show tech support"); my @output2 = $ssh->exec("show ver"); print "Output = @output\n"; print "Output1 = @output1\n"; print "Output2 = @output2\n"; ssh->close();