从 mac 上的行读取 gzip 行

Reading gzip line from line on a mac

我有一个庞大的 .gz 文件,我可以通过

在 Perl/Linux 上阅读
open my $zc, 'zcat GCF_000001405.25.gz|';

但是当我在 Mac (Perl 5.32.1) 上 运行 这段代码时,我得到一个错误:

zcat: can't stat: GCF_000001405.25.gz (GCF_000001405.25.gz.Z): No such file or directory

关注https://serverfault.com/questions/570024/zcat-gzcat-works-in-linux-not-on-osx-general-linux-osx-compatibility

我试过了

open my $zc, 'zcat < GCF_000001405.25.gz';

但这给出了错误:

readline() on closed filehandle $zc at split.by.chr.pl line 32

我知道 Compress::Zlib 但是它很慢 How to read data in .gz file very fast in perl programming

如何更改我的 perl 脚本中的 open 行,以便它可以在 Mac 上运行?

对 OP 的尝试遗漏了 |,表明该字符串是 运行 的程序,而不是文件名。因此,正确的答案是使用

open my $zc, 'zcat < GCF_000001405.25.gz|';

https://alvinalexander.com/perl/edu/articles/pl010004.shtml