in reply to maddening system call gzip/gunzip problems
use File::Find; my $dir = "/home/lprjob1/filest" find( sub { push @files, $File::Find::name if -f && /.+gz/ }, $dir );
Then I would look into using some of the CPAN modules associated with gzip like Tie::Gzip. If the files you are looking to process are text files, you can tie them to a gzip'd filehandle and read them:
use Tie::Gzip; for my $log (@files) { tie *LOG, 'Tie::Gzip'; open (\*LOG, '<', "$log") or die("Cannot open $log: $!"); while (my $line = <LOG>) { # Iterate over the files here and do blah } close (LOG); untie *LOG; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: maddening system call gzip/gunzip problems
by graff (Chancellor) on Dec 08, 2006 at 02:09 UTC |