Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
... foreach my $zips (@zfiles) { .... # $zips will have 2 zip files getzip( $zips ); } sub getzip { my $zip_file = shift; return unless ($zip_file); print "\n Getting this first::: $zip_file\n\n"; my $zipdir = "zips/"; my $zip = Archive::Zip->new( $zipdir . $zip_file ) || die; foreach my $member ($zip->members()) { my $member_file_name = $member->fileName(); push @members_name, $member_file_name; } my @xmlfile = $zip->membersMatching( '.*\.xml' ); foreach (@xmlfile) { my $contents = $_->contents(); open my $contents_fh, '<', \$contents or die "Can't open scalar filehandle: $!"; my $first_line = <$contents_fh>; while (<$contents_fh>) { chomp; if(/<acc>(.*?)<\/acc>/gi) { my $accnumb = $1; foreach (@members_name) { if (/^($accnumb)_/g) { do_img($zip, $accnumb, $_ ); } } } } } } # End get zip
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting the right ZIP file Help!
by NetWallah (Canon) on Mar 02, 2011 at 05:28 UTC |