perl - 文件操作(一)

#!I:/Perl64/bin/Perl.exe

$file = "test.log";
if (!open(T, "test.log")) {
    print "open file:$file failed!\n";
}
$b = <T>; # 一行
@a = <T>; # 剩下的所有行
close(T);

print "=====\$b============$b\n";
print "=====\@a============\n";
print "@a\n";

输出

perl - 文件操作(一)_第1张图片

test.log

abcdefg hijk
lmn opq
rst uvw
xyz



你可能感兴趣的:(文件,open)