我试图理解一些用于逐块读取文本文件的Perl代码。
文本文件MYFILE
如下所示:
First block
First Line: Something in here
Second Line: More here
Third Line: etc.
Second block
First Line: Something in here
Second Line: More here
Third Line: etc.
该代码用于提取找到正则表达式的块的行(它工作正常,我只是想理解它)。
这是我不明白的代码部分:
local $/ = q||;
while (<MYFILE>) {
do something;
}
有人可以向我解释一下这条线local $/ = q||;
在做什么吗?