use strict; use warnings; $| = 1; require 'Comm.pl'; use IPC::Open3 qw/open3/; &Comm::init(1.8); my $TimeOut = 30; my $Server = 'Server'; my $User = 'User'; my $Password = 'Password'; my ( $Proc_pty_handle, $Proc_tty_handle, $pid ) = &open_proc( "bteq"); die "open_proc failed" unless $Proc_pty_handle; my ($success, $matched, $before_match, $after_match) = &expect($Proc_pty_handle, $TimeOut, 'Enter your logon or BTEQ command:'); die("Time out\n") unless ($success); print(" \$matched \[$matched\] \$before_match\[$before_match\] \$success \[$success\] \$after_match \[$after_match \] "); print $Proc_pty_handle ".logon $Server/$User\n";