Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: How to test if a file is gzipped or not

by Anonymous Monk
on Jun 17, 2024 at 23:43 UTC ( [id://11160051]=note: print w/replies, xml ) Need Help??


in reply to How to test if a file is gzipped or not

If zcat throws an error then you know it's not gzipped:
open(FOO, "zcat $foo |") || open(FOO, $foo) || die("ERROR: Unable to o +pen file $foo for read: $!");

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11160051]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-09-07 21:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.