Home: Perl Programming Help: Beginner:
Unable to send using Perl Expect



newtoperl123
New User

Aug 2, 2013, 3:12 AM


Views: 984
Unable to send using Perl Expect

Hi ,

I have the following perl expect script, the send function does not work, basically I need to enter 'y' for an interactive script , but the following script does not send 'y'

can some one please check why send does not work.

Thanks ..



Code
use Expect; 
my $ex = Expect->new;
my $login ="/my/app/test autoupdate";
my $update = Expect->spawn($login) or die "Can't run autoupdate : $!\n";

print "Autoupdate $login\n";
if($update->expect(6,'Update?')){
print "spawn continue";
#$test=$update->expect(6,'Update?');
$test2=$update->send("y\r");
my $exp = Expect->send("y\r");}
else { print "not spawn";}
print "Test is $exp";