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) } }
Dum Spiro Spero

In reply to Re: Reading zipped files (.gz) by GotToBTru
in thread Reading zipped files (.gz) by ravi45722

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.