in reply to Question on IO::UnCompress::GunZip...

For greater precision, here's another way. Download the Archive::Extract tarball, then:
#!/usr/bin/perl use strict; use warnings; use Archive::Extract; my $ae = Archive::Extract->new( archive => '/path/to/Archive-Extract- +0.38.tar.gz' ); my $ok = $ae->extract( to => '/path/to/Archive-Extract' ); my $files = $ae->files; my $outdir = $ae->extract_path; $ae->is_tgz; print $outdir, "\n"; chdir($outdir); my $lines = 0; my $filename = 'README'; die "Can't open '${filename}': $!" unless open FILE, $filename; while (sysread FILE, my $buffer, 4096) { $lines += ($buffer =~ tr/\n//); } close FILE; print "$lines\n";

Replies are listed 'Best First'.
Re^2: Question on IO::UnCompress::GunZip...
by rementis (Beadle) on Jan 17, 2010 at 21:47 UTC
    Man, perl monks are awesome. I don't even need this information, but it's so cool to see great solutions provided.
        Hi, Can anybody please answer my question? How can i read data from a compressed file without unzipping it? Unlike one of the monks had pointed out, Archive::Zip does not seem to be able to read data from a zip file without having to unzip it first. Please help.