-7
如何从文件夹中读取文件?我想从目录文件夹中读取文件
香港专业教育学院试图
open(my $yourhandle, '<', 'spool.txt')
or die "Unable to open file, $!";
close($yourhandle);
但是,代码只打开文件,不要阅读:/
如何从文件夹中读取文件?我想从目录文件夹中读取文件
香港专业教育学院试图
open(my $yourhandle, '<', 'spool.txt')
or die "Unable to open file, $!";
close($yourhandle);
但是,代码只打开文件,不要阅读:/
使用钻石经营者从一个打开的文件句柄阅读:
open my $FH, '<', '/path/to/spool.txt' or die $!;
while (my $line = <$FH>) {
print "I've read: $line";
}
close $FH;
另请参阅perl doc [perlintro](http:// perldoc .perl.org/perlintro.html#文件和文件I%2FO) – Sobrique
类型“如何将perl中的文件读入搜索引擎? – KevinDTimm
这在perl中有介绍:[perlintro](http://perldoc.perl.org/perlintro.html#Files-and-I%2fO) – Sobrique