The following code takes the output of the usershow command and puts it
into an array. It then puts the output I want (in this output that does
not match a list of patterns) into a separate array. Does this code help
your cause?
my @userarray3;
print $session "usershow\r";
my @userarray1 =3D $session->expect(30, -re, "$SC_PROMPT");
my @userarray2 =3D split ('\n', $userarray1[3]);
for (my $s =3D 0; $s <=3D $#userarray2; $s++) {
if ($userarray2[$s] !~
/$SC_PROMPT|username\s+permissions\s+password\?|usershow|-{6,}/) {
push (@userarray3, $userarray2[$s]);
}
}
=B7=BD=EA=C9 wrote:
> I am the beginner of Expect.I want to store the output of the process i=
n my own array when use Expect. e.g. if I send a command to a ftp process=
, and I want to store it's return value into my array, such as @filelist.=
How can I? If I use expect(), the result is just printed on the STDOUT. =
Thanks a lot.HS^=81=7F+,=A6=89=EC=A2=B7=9Do$=A9y=E7R=B5=AA=EDb=8B=AB.)=EE=
=C4
> i=B0=DA0=06=E8=A5u=A9=DDu=EAe=81=7F&=A9=A6=C5=9En=C7=AB=81=7F'=1E=B1=FA=
+.)=EE=C7=08=AD=85=A7=EBy=E0=D5=0E=81=7F=1F=81=7F=06=ABzH=AD~=81=7F& =13=02=
=81=7F'$6=81=7F!=B6=DA?=FD=A7l=A2=C7gr=89=BFi=D8=9D=03]=E9=A9e=A1=C8=81=7F=
=03~=F2=8ArX=9C=90Liy=CBiz=B9]=8A=C7.=B2=C9=9A=8AX=A7=82X=AC=B4Liy=CBiz=B9=
]=8A=C7.=B2=C9b=B2=DB,=A2=EA=DCy=81=7F+=81=E9=DE=B6=1Bm=A6=CF=81=7F=81=7F=
+-=B2=CA.=AD=C7=9F=A2=81=7F=1E=9D=EB?=81=7F+-=B3=F9b=B2=D8=A7~=8F=DE=C6=97=
=9C=B6=97=AB=95=D8=ACr=81=7F,
|