Instead of opening an extra process (zcat), one can also use modules as already mentioned. Like PerlIO::gzip. For inconsistency gzip is also supported in PerlIO::via::gzip, the two other perlio compress/decompress supported algorithms in that namespace are PerlIO::via::Bzip2 and PerlIO::via::xz.
On CPAN you can find a plethora of decompressors in the IO::Uncompress namespace where IO::Uncompress::Gunzip is part of (CORE since 5.9.4)
In reply to Re: How to test if a file is gzipped or not
by Tux
in thread How to test if a file is gzipped or not
by Special_K
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |