1
我試圖讀取位於遠程主機(ubuntu)上的/ root目錄下的文件(temp.txt),它位於同一個局域網中(ssh和ftp打開) The perl腳本能夠連接並出現一個OpenSSH對話框,詢問密碼,然後程序exists.Please任何人都可以幫助..下面是我的腳本。使用perl從遠程主機讀取文件
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.