in reply to Net::SSH::Perl remote copying issues
It is likely that on the target system with cp -r the detination directory must exist. (Added: Also all components of the path must exist regardless of the system: does at least /var/www/localhost/htdocs exist?) It appears that /var/www/localhost/htdocs/test does not. You can use mkdir to create it.