How to zip files from perl.?

Posted on 2001-07-10
Medium Priority
Last Modified: 2012-06-27
I am using Perl 5.003_7 and windowNT. I want to zip all .dat file from a folder. How do I zip that files. help me.
Question by:arogyarajxavier
LVL 19

Accepted Solution

Kim Ryan earned 200 total points
ID: 6271856
You will need to dowwnload the Zlib module and install it first: http://search.cpan.org/search?dist=Compress-Zlib

use Compress::Zlib ;


while <*.dat> {
  open(IN_FH, "<$_");
  $gz = gzopen($compressed_filename, "wb"); # write binary
  while (<IN_FH>) {
  $status = $gz->gzclose() ;


Expert Comment

ID: 6272321
You may also use the Archive::Zip module available from CPAN to do the same task.


Author Comment

ID: 6339603
Thanks teraplane

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question