in reply to Running Perl in an Expect loop

You use Expect to essentially screen scrape output because you do not have API hooks to program against. In this case, you have Perl and you want to interface with Perl. So don't use Expect. Use Perl.