Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: Archive::Tar extract

by trizen (Hermit)
on Apr 17, 2012 at 12:24 UTC ( #965501=note: print w/replies, xml ) Need Help??


in reply to Re^2: Archive::Tar extract
in thread Archive::Tar extract

Here we go:
use strict; use warnings; use Archive::Tar; use File::Spec::Functions qw(catdir); my $input = "libpst.tar.gz"; my $tar = Archive::Tar->new($input); my @files = $tar->list_files; my $output_dir = 'path'; # change this foreach my $file (@files) { my $extracted_file = catdir($output_dir, $file); $tar->extract_file($file, $extracted_file); if ($file =~ /\.txt\z/) { # or whatever open my $fh, '<', $extracted_file or do { warn "$0: Can't open + file $file: $!"; next }; while (defined(my $line = <$fh>)) { # do something with $line } close $fh; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://965501]
help
Chatterbox?
[atcroft]: Lady_Aleena: I found the L<name|section> syntax, which describes linking to a perl manual page, and L<text|url> to link to a web page. The reason I asked was because I was on search.cpan.org looking at a module,
[atcroft]: and it referred to several other modules, but the links went to metacpan.org. I found that a bit of a surprise, and it got me wondering if there was a "standard" way to link to other modules in the documentation on CPAN.
[Lady_Aleena]: atcroft. maybe look at raw PODs. There is also L<foo|http://foo. com> and some might be linking directly to meta::cpan.
[Lady_Aleena]: Oops, didn't read the L<text|url> right.

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2017-05-27 03:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?