hi,


pls. find below my code for your perusal.

Also, i am using Active perl 5.8 which includes Archive::Zip

use Archive::Zip; use Archive::Zip::MemberRead; opendir(DIR, "$ARGV[0]") || die "Can't open the '' directory"; @dr = grep(/\.zip/, readdir(DIR)); closedir(DIR); undef $/; foreach $ZipFilName (sort @dr) { my %ZipCnt = &Zip_XmlCount($ARGV[0]."\\".$ZipFilName); #### my required output print "$ZipCnt{'xml'}\t$ZipCnt{'pdf'}\t$ZipCnt{'title'}\n"; #### } sub Zip_XmlCount { my ($zipfile, $pdfCnt, $xmlCnt, %zipcnt) = @_; my $zip = Archive::Zip->new(); die "can't read '$zipfile' file" unless $zip->read($zipfile) eq 0; for($zip->memberNames()) { $xmlCnt++ if ($_ =~ /\.xml/is); # xml count $pdfCnt++ if ($_ =~ /\.pdf/is); # pdf count ########### problematic code $fh = new Archive::Zip::MemberRead($zipfile, "./$zpname"); while (defined($line = $fh->getline())) { $line =~ /<article-title>(.+)<\/article-title>/g; # articl +e-title inside xml file $title = $1; } ########### } $xmlCnt ||=0; $pdfCnt ||=0; $zipcnt{'xml'} = $xmlCnt; $zipcnt{'pdf'} = $pdfCnt; $zipcnt{'title +'} = $title; return %zipcnt; }
ssk

In reply to Re^2: problem with Zip::MemberRead by ssk
in thread problem with Zip::MemberRead by ssk

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.