Hi all, I am so-so layman to Perl, and I hit a stumbling block and hoping that this is a quick and easy question. I am write some scripts in Perl on a Windows machine, and I need to handle .tar.gz files. Specifically I need to un-tar.gz them so I can do some regex with them. I am trying to use the Archive::Tar package and I think I am hitting a wall because the example code on the CPAN page is dealing with objects, and I am not an object man. Consider this script:
#!/usr/bin/perl -w use strict; use Archive::Tar; my $tar = Archive::Tar->new; $tar->read('file.tar.gz'); $tar->extract();
So almost an example cut and paste from the CPAN page, now my original thought is that $tar is then a long string that I can do what I want. But when I printed it out I got the following:
Archive::Tar=HASH(0x2dd2a4)
Ok... So it is a hash, but I don't know what the keys are, so doing a little digging in Perl Cookbook I get a snippet of code to tell me what the keys are and find out that $tar is not a hash... stumped... In theory all I would like to do it dump the contents of the tar.gz file into a string then slice and dice, but I can't seem to get to the contents. Can any one point me in the right direction? I would really appreciate it. Cheers

In reply to Archive::Tar basic question by drblove27

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.