7.6. Simple computation - separate send commandsInstead of calling send once, we will call it now 4 times Example 7-2. examples/bc/bc2.pl #!/usr/bin/perl
use strict;
use warnings;
use Expect;
my $e = Expect->new;
$e->raw_pty(1);
$e->spawn("bc") or die "Cannot run bc\n";
$e->expect(1, "warranty") or die "no warranty\n";
$e->send("23");
$e->send("+");
$e->send("7");
$e->send("\n");
$e->expect(1, 30) or die "no sum\n";
print "Success\n";
|