我正在尝试从 ubuntu 机器读取位于同一 LAN 中远程主机(ubuntu)上 /root 目录下的文件(temp.txt)。(ssh 和 ftp 已打开) perl 脚本能够连接并出现 OpenSSH 对话框要求密码,然后程序存在。请任何人帮助..以下是我的脚本。
use POSIX qw(strftime);
use strict;
use warnings;
use File::Remote;
my $remote = new File::Remote;
# Standard filehandles
$remote->open(FILE, ">>X.X.X.X:/root/temp.txt") or die $!;
print FILE "Here's a line that's added.\n";
$remote->close(FILE);
执行时出现以下错误。
Bareword "FILE" not allowed while "strict subs" in use at /root/Desktop/test.pl line 10.
Bareword "FILE" not allowed while "strict subs" in use at /root/Desktop/test.pl line 12.
Execution of /root/Desktop/test.pl aborted due to compilation errors.