in reply to Re^2: Reading a .txt file under 2 levels of compression
in thread Reading a .txt file under 2 levels of compression
after which you can continue:use IO::Uncompress::Unzip qw(unzip $UnzipError); my $file = '2.zip'; my $inner; unzip $file, \$inner, Name => '1.zip';
and now the text will be in the string $txt. (Caveat: untested)my $txt; unzip \$inner, \$txt, Name => '1.txt';
Apparently the "Name => $name" part is optional if the ZIP archive contains only one file (what they call a "member file"):
Say you have a zip file, file1.zip, that only contains a single member, you can read it and write the uncompressed data to the file file1.txt like this.unzip $input => $output or die "unzip failed: $UnzipError\n";If you have a zip file that contains multiple members and want to read a specific member from the file, say "data1", use the Name option
unzip $input => $output, Name => "data1" or die "unzip failed: $UnzipError\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Reading a .txt file under 2 levels of compression
by pmqs (Friar) on Jan 12, 2011 at 13:44 UTC | |
|
Re^4: Reading a .txt file under 2 levels of compression
by LazyIntern (Initiate) on Jan 13, 2011 at 01:04 UTC | |
by pmqs (Friar) on Jan 13, 2011 at 10:56 UTC | |
by bart (Canon) on Jan 13, 2011 at 12:17 UTC | |
by LazyIntern (Initiate) on Jan 14, 2011 at 00:45 UTC |