You include Archive::Tar in your code and your @cdr_list array is meant to be populated with a list of (gzipped) tars, but your dump of the variable doesn't match your command since none of those files is a tar. So, assuming the mention of tar is an artifact and you really just need to deal with zipped files:
use IO::Zlib; my $fh = new IO::Zlib; $fh->open('zipfile.gz','rb'); while(<$fh>) { print } $fh->close
If/when you decide to deal with gzipped tars, Archive::Tar can open gzipped files automatically without needing to explicitly unzip them.
chomp @cdr_list; foreach my $tarzip (@cdr_list) { my $tar = Archive::Tar->new($tarzip); foreach my $file ($tar->list_files) { print $tar->get_content($file) } }
In reply to Re: Reading zipped files (.gz)
by GotToBTru
in thread Reading zipped files (.gz)
by ravi45722
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |