我的代码涉及到主机(使用openSSH),获取与模式匹配的文件列表(使用远程查找命令-OpenSSH),然后打开我得到的每个文件并处理每个文件(grepping等)。我完成了获取文件名并传递给函数。现在,我必须将这些文件名传递给我打开每个文件名并处理它的函数。我正在尝试使用 File::Remote 执行此操作,如下所示:
sub processFiles{
my $fileList =shift;
#Iterate over the file and try to find start and stop time stamps from the file
for my $file ( @{$fileList}) {
#finding start time of file:its found in lines of file
my $HEAD;
open $HEAD, "host:head -1000 $File|" or die "Unable to check file for starting time";
while ( <$HEAD> ) {
#process...
但是我无法在主机上打开文件,并且出现错误。