Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: gzip written in perl

by graff (Chancellor)
on Nov 04, 2002 at 03:29 UTC ( #210114=note: print w/replies, xml ) Need Help??


in reply to gzip written in perl

With Perl 5.8, you can also use PerlIO::gzip and read/write gzip data though an IO layer -- e.g. here's a script that reads a gzipped file, numbers the lines, and writes the result to a new gzipped file:
use PerlIO::gzip; open IN, "<:gzip", "somefile.gz" or die "$!\n"; open OUT, ">:gzip", "numbered.gz" or die "$!\n"; while (<IN>) { print OUT join " ", ++$i, $_; }
(God, I love it!)

UPDATE: (2010-10-18) It seems that PerlIO::gzip should be viewed as superseded by PerlIO::via:gzip. (see PerlIO::gzip or PerlIO::via::gzip).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://210114]
help
Chatterbox?
[msh210]: wow... talk about overkill... seeking a Perl way to split a file by size while ending on a line ending, and only then discovered that split -C will do it
[Tux]: Discipulus I don't have MCE due to some block inside its dependency chain
[Tux]: indeed: I do have MCE, but not MCE::Hobo as it requires LEHMANNware

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2017-09-20 07:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (234 votes). Check out past polls.

    Notices?