use strict; use warnings; use Expect; my $command = Expect->spawn("telnet 000.000.000.000"); print "looking for 'login:'\n"; unless($command->expect(10, "login:")) { die "timed out"; } print $command "\n"; unless($command->expect(60, -re=> 'assword: ?')) { die "timed out"; } print $command "\n"; unless($command->expect(60, -re=> 'cr.*')) { die "timed out"; } print "------------------\n"; print $command "show inventory\n"; $command->hard_close();