use strict; use warnings; #### use strict; use warnings; use Expect; # This example assumes that the test script returns "Next Line" after "y" is pressed my $login ="/my/app/test autoupdate"; my $update = Expect->spawn($login) or die "Can't run autoupdate : $!\n"; $update->expect(60, [ qr'Update?', sub { print "Sending y"; (shift)->send("y\r"); exp_continue; } ], [ qr'Next Line', sub { print "y was accepted"; } ], [ timeout => sub { print "Drag we timed out"; } ], [ eof => sub { print "Ooops, something went wrong"; } ], );