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";
|