in reply to Using PerlIO::gzip

`perldoc PerlIO'
I don't know if it'll work, but try something like this (untested):
use strict; use warnings; my $infile = 'hi.txt'; my $outfile = 'hi.gz'; open my $in, '<:raw', $infile or die $!; open my $out, '>:gzip', $outfile or die $!; while(defined( my $read = read $in, my $s, 2048 ) ){ die "Error reading 2048: $!" if $read != 2048; print {$out} $s; } close $in; close $out;

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.

Replies are listed 'Best First'.
Re^2: Using PerlIO::gzip
by heigold1 (Acolyte) on Jun 25, 2004 at 21:17 UTC
    Hi, thank you so much for your response.

    The reason why I used PDF as an example was that I just wanted to create a GZIP file out of anything that wasn't a straight text or .dat file.

    So if you could provide an example of creating a GZIP file without using a text file that would be greatly appreciated.

    Brent.
      replace hi.txt with WHATEVER.WHATEVER or WHATEVER.pdf and there you go (mindblowing isn't it)