screen shot: Sending ls command! Starting EXPECT pattern matching... at /export/dmzsupp/perl5/5.14.2/lib/site_perl/5.14.2/Expect.pm line 561 Expect::expect('Expect=GLOB(0x65ca28)', 6, 'ARRAY(0x9b6460)', 'ARRAY(0x9b6328)', '-re', 'Regexp=REGEXP(0x9990d8)') called at ./fwlogin.pl line 42 Error,Timeout while waiting 6 secs for ls command on [sol8server] user[user]. Error:1:TIMEOUT Continuing $VAR1 = [ undef, '1:TIMEOUT', undef, '', undef, undef ]; The code: print "\nSending ls command!\n\n"; $sshFW->send("ls\r"); @exp_stat = $sshFW->expect($expTimeOut, # Timeout trap [timeout => sub { $expFWStatus = 1; $expFWmatchString = $sshFW->match; print "Error,Timeout while waiting $expTimeOut secs for ls command on [$FWHost] user[$usr]. Error:" . $sshFW->exp_error() . "\n"; } ], # EOF trap [eof => sub { $expFWStatus = 2; $expFWmatchString = $sshFW->match; print "Error,Premature EOF during ls command for [$FWHost] user[$usr]. Error:" . $sshFW->exp_error() . "\n"; } ], '-re', qr /% $/, ); # End expect, got Unix prompt ok print "\nContinuing\n\n"; print Dumper(\@exp_stat);#debug # The above behaves just like the ls command was never sent!