calling an expect script from perl script – Education Career Blog

here is my perl script(a.pl)

#!/usr/bin/perl 
$logfile = "./a.log";
open(LOGFILE_Handle, ">$logfile")  or die "Error : Can not open $logfile !!! \n\n ";
print LOGFILE_Handle "a.pl:  1 "; 
system "./a.exp "; 

here is my expect script(a.exp)

#!/opt/sfw/bin/expect -f
log_user 1;
set logfile "./a.log";
set LOGFILE_Handle open "$logfile" "a" 0666
puts $LOGFILE_Handle "a.exp: A" 
send_user "Hi";

while running, the perl script, it doesnt call expect script..
is there anything im missing

Thanks in advance..

,

I suggest you replace system "./a.exp "; with system qw(expect ./a.exp);

Alternatively, you should check that your execution directory allow you to refer to ./a.exp.

Leave a Comment