From: Jason G. <JG...@cw...> - 2007-05-08 15:14:15
|
I just made the switch to expect.pm also, so this is fresh in my mind. I = use " $var =3D ($exp->matchlist)[0] " for the first matched item. Make = sure you use the parenthesis exactly as listed or it will not work. --Jason >>> <sp...@nc...> 4/24/2007 6:35 PM >>> Hello all, I've used the "real" expect for a number of years, and now find myself having to do some stuff w/ perl-expect. Is there a way to capture text w/ () in the expect of perl like you can w/ expect? For example the following bit of expect code will grab the hostname of the device you've logged into and store it in a variable called hostname: expect { -re "\n+(.*}>" } set hostname $expect_out(1,string) The $expect_out(1,string) grabs what is inside the () in the expect statement. Like a backrefrence \1 in a regexp. Is there a way to do the same thing w/ perl expect? Thanks in advance. Sean ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/=20 _______________________________________________ Expectperl-discuss mailing list Exp...@li...=20 https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |