in reply to working with Expect module

slayedbylucifer:

Change this:

my @parameters = ('$_', 'uptime');

to this:

my @parameters = ($_, 'uptime');

Your version is using THE NAME of variable $_ as an IP address, rather than THE CONTENTS. Single (') and double (") quotes are different, so if you used:

my @parameters = ("$_", 'uptime');

your code would have worked, because inside double quotes, the variables contents would replace its name in the string. However, just putting quotes around a variable name is discouraged.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Replies are listed 'Best First'.
Re^2: working with Expect module
by slayedbylucifer (Scribe) on Dec 28, 2010 at 07:11 UTC
    Hi roboticus, thanks you very much. it's working now. BTW, i have posted a follow-up (but different) question @ http://www.perlmonks.org/?node_id=879388 Would really appreciate your help. thanks again.

      slayedbylucifer:

      It looks like ahmad may have already found it for you. By the way, when you know the node ID of a node, it's easy to link to it like this: [id://879388] gives you: Expect module and running "su". If you want to give the link a different name, just put a vertical bar and the new name before the closing bracket, so [id://879388|the other question] gives you a link to the other question.

      ...roboticus

      When your only tool is a hammer, all problems look like your thumb.