in reply to Re: storing return value from Expect
in thread storing return value from Expect
If called in a scalar context, expect() will return the position of the matched pattern within $match_patterns, or undef if no pattern was matched. This is a position starting from 1, so if you want to know which of an array of @matched_patterns matched you should subtract one from the return value.
If called in an array context expect() will return ($matched_pattern_position, $error, $successfully_matching_string, $before_match, and $after_match).
Also, please note that \r might not work with some programs when raw mode is activated. Normally expect does cr->lf translation, but this is disabled in raw mode. From a brief read of the docs, i think they are suggesting that \n is actually the better choice.
|
|---|