On Tue, Feb 05, 2013 at 02:39:17PM -0800, Rajeev Prasad wrote: > which i am calling like this: > > $expect->log_file(\&captureexpectout);
Note that 'captureexpectout' is hard to read and hard to write
properly. You should use underscores or mixed case to fix this
e.g., capture_expect_out.
> Now I want to call this subroutine with arguments. I tried
> below but I got error...
>
> $expect->log_file(\&captureexpectout($_,$myarg));
I'm not familiar with the module, but it looks like it expects a
code reference. You can wrap your call in another subroutine
(anonymous or named).
my $wrapper = sub { capture_expect_out(shift, $my_arg) };
$expect->log_file($wrapper);
See `perldoc perlsub' and `perldoc perlref', et al.
Regards,
--
Brandon McCaig <[email protected]> <[email protected]>
Castopulence Software <https://www.castopulence.org/>
Blog <http://www.bamccaig.com/>
perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }.
q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.};
tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'
signature.asc
Description: Digital signature
