in reply to Net::SCP::Expect causes error in return code

Given the indentation, I am guessing you removed code you deemed unnecessary. When you say 'removing the "use Net::SCP::Expect" line...', is it really the case that you are not actually creating any objects using the module? Or have you commented out these too? They may be important.

Another thing you could do is try to see what the command is saying when it fails. You could replace

my $cmd = qq{rpm -qa | grep cluster};
with
my $cmd = qq{rpm -qa &> /tmp/bad_call };
(replace &> with something else if bash is not your default shell) Then look at /tmp/bad_call to see what it reported.

fnord