I think that was a pretty arrogant and ignorant remark from the anonymous monk that replied to your last query. Perhaps if he doesn't have anything to offer he shouldn't offer anything at all.
Heres an example of perl using expect (hope this helps):
#!/usr/bin/perl
use strict;
use Expect;
my $session = new Expect;
$session->spawn("/usr/bin/bash");
print $session "cd \/home\/homedir\r";
$session->expect(90, -re, "bash");
print $session "ls -altr\r";
my @array = $session->expect(60, -re, "bash");
$session->clear_accum;
my @array1 = split('\n', $array[3]);
for (my $i = 0; $i <= $#array1; $i++) {
print "\nElement $i is\n$array1[$i]\n";
}