Hi cryptonite1,
I haven't used Expect much, but the documentation says
If called in an array context expect() will return ($matched_pattern_position, $error, $successfully_matching_string, $before_match, and $after_match).
So that would mean something like
my ($match_pos, $error, $match_string, $before_match, $after_match) = +$exp->expect( $timeout, ... );
(Untested) Update: Fixed a copy/paste mistake, and I tried it out and in your case you'll probably be interested in the string $after_match, since that will contain the rest of the line after the regex "Backup file location:". It'll still have whitespace and newlines on the ends of the string, so you'll have to do something like $after_match =~ s/^\s+|\s+$//g; to get rid of it.
Hope this helps,
-- Hauke D
In reply to Re: Perl Expect : Get the complete matched string (updated)
by haukex
in thread Perl Expect : Get the complete matched string
by cryptonite1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |