From: Allen H. <al...@hu...> - 2003-08-22 08:27:56
|
I haven't tried exactly what you are doing, but how about this: [ qr/SQL>/i =3D> sub{ dothis(param); dothat(param); }] Allen On Tuesday, August 19, 2003, at 06:54 PM, Wu, LT (=A7d=CD=DD=BCw IEC1) = wrote: > Hi, > =20 > I'm having this problem. > I know we can use subroutine in this way, > =20 > [ timeout =3D> sub{$exp->send("quit\n");}], > =20 > or call a subroutine in this way, > =20 > [ qr/SQL>/i =3D> \&dothis ], > =20 > but I want to pass parameters along with the subroutine call, > so I write in this way, > =20 > [ timeout =3D> sub{$exp->send("quit\n");}], > [ qr/SQL>/i =3D> \&dothis(param) ], > =20 > but it generated such error message: > =20 > "Pattern #2 doesn't have a CODE referenceafter the pattern" > =20 > Then the timeout in 1st line cannot work, > although the subroutine did receive the parameter. > =20 > So that means I cannot pass any parameters within Expect statement. > How can I solve this problem? > Thanks. > =20 > =20 > Liang > =20 > al...@hu... www.hutchison.org/allen/ |