Just redirect stderr into a file. See also the log_file method.
$object->log_file("filename" | $filehandle | \&coderef | undef) Log session to a file. All characters send to or received +from the spawned process are written to the file. Normally appends +to the logfile, but you can pass an additional mode of "w" to trun +cate the file upon open():
In reply to Re: Send "Expect.pm" debug and screen output to a file
by Fletch
in thread Send "Expect.pm" debug and screen output to a file
by chime
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |