use IPC::Run qw(start pump finish); my @args; push @args, $app_path; my ($in, $out, $err); # starting the application my $handle = start \@args, \$in, \$out, \$err; # wait until prompted for input pump $handle until $out =~ /Login:/; $in .= "Boris\n"; # wait until prompted for password pump $handle until $out =~ /Password:/; # and so on ... #### $client_descr->{"Handle"} = $handle; $client_descr->{"In"} = $in; $client_descr->{"Out"} = $out; $client_descr->{"Err"} = $err; #### my ($handle, $in, $out) = ($client_descr->{"Handle"}, $client_descr->{"In"}, $client_descr->{"Out"}); #### $in .= "new data\n"; pump $handle until $out =~ /data arrived:/; print $out;