in reply to Expect.pm question

You could wait for the next prompt after having issued the listdev command, and then print out the accumulated buffer contents, accessible via before(). Something like

... print $ssh "listdev\n"; unless ($ssh->expect(10,"sysadmin>")) { die "listdev command never finished, " .$ssh->exp_error()."\n" +; } my $out = $ssh->before();