($rad) = $telobj -> cmd ("cd /usr/local/etc/httpd/logs");
This way the left hand side (lhs) of the assignment operator is a list, and its first element - $rad - will be assigned the first value of the list returned by the cmd method. Note that $rad is enclosed in parens, which makes the lhs a list statement.
To check whether the previous cd command has been succesful, you could do:
($rad) = $telobj->("pwd");
if($rad eq '/usr/local/etc/httpd/logs') {
print "cd command successful. working directory is $rad\n";
} else {
print "cd command failed. working directory is $rad\n";
}
But it's even easier in fact. The cd shell command doesn't return anything if successful, only on failure. So, you could just say
($rad) = $telobj -> cmd ("cd /usr/local/etc/httpd/logs");
if($rad) {
die "Can't change directory: $rad\n";
}
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|