Hi Monks!
I have this sub in my code which at this point It will be called twice and it will be processing 2 zip files. One zip file will have image files and the other is a XML file that will have the names of these images in its node </acc>, I am matching them, that works, but when I am trying to send the right zip file in $zip, which has to be the zip file containing the images to the "do_img" sub routine to get processed, I am sending the wrong zip, its getting the zip with the XML file and not the zip file with the images, that's where I am stuck. How could I send the right zip file, at this line: do_img($zip, $accnumb, $_ );. I just cant see it.
... 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

Thanks for the help!

In reply to Getting the right ZIP file Help! by Anonymous Monk

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.