Hi,
I am using Expect
in Perl to accomplish one task. After sending the command I am expecting either Success
or ERROR
as the output, depending on which I need to print to a file saying that it was successful or failed.
$exp->expect(30,
'-re', "Success", printf LOG "Successfully Deleted \n" => sub {exp_last;},
'-re', "ERROR", printf LOG "Error in Deletion \n",
);
LOG
is a file handle. If I use this, then even if I get Success
as the output of the send
command both the regular expressions are getting executed. In my log file, I am getting
Error in Deletion
Successfully Deleted
How do I solve this?