Hi there List people,
I am hoping to send a hash and a scalar to a subroutine but the variable
is not completely being sent. Below is the error message below is
showing something is not getting passed that well to the subroutine.
Looks like %login is empty.
--- snip ---
$ret{$hostnames[0]} = $login{$hostnames[0]}->send_cmd("edit");
$ret{$hostnames[1]} = $login{$hostnames[1]}->send_cmd("edit");
if ($ret{$hostnames[0]} =~ /^blah/m) {
exiting ($hostnames[0], %login);
}
if ($ret{$hostnames[1]} =~ /^blah/m) {
exiting ($hostnames[1], %login);
}
sub exiting {
my ($hostname, %login) = @_;
my ($ret);
print "login: $login $hostname\n";
my ( $position, $error, $matched, $before, $after ) =
$login{$hostname} -> send("exit\n");
print "position: $position, $error, $matched, $before, $after \n";
exit 0;
if ($ret{$hostname} =~ /^blah/m) {
$login{$hostname}->send_cmd("yes")
}
$ret{$hostname} = $login{$hostname}->send_cmd("exit");
}
---- snip ----
here is the beginning of send_cmd called from a perl module library.
---- snip ----
sub send_cmd {
my ( $self, $seconds, $cmd ) = @_;
if ( !$cmd ) {
if ( $seconds !~ /^\d+/ ) {
$cmd = $seconds;
$seconds = 10;
}
} ## end if ( !$cmd )
chomp $cmd;
--- snip ----
here is the error message below is showing something is not
getting passed that well to the subroutine. Looks like %login is empty.
----- snip ----
Use of uninitialized value in concatenation (.) or string
--- snip ----
Cheers,
Noah
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/