From: Roland G. <rgi...@cp...> - 2009-02-17 10:20:37
|
Prashar wrote: > [ > '\s*MP Host Name:(.*)', > sub { > my $fh = shift; > $tmp = ($fh->matchlist)[0]; > $tmp =~ s/\s+//g; > $tmp =~ s/^\s+//g; > exp_continue; > } > ], > "\[$tmp\] MP\> ", > > But I think $tmp will never have the value assigned to it in a #5 pattern > match routine as the list of patterns are prepared at the beginning before > spawning for match. hence we see the $tmp as null ( which was defined > globally). Right, this cannot work, you try to change the match pattern after it was already passed to the expect() call. For this to work, you must exit the first expect() call and enter another expect(), this time with the captured prompt string. Hope this helps, Roland |