Hi Experts,

I am reading a zipped file from and counting the number of occurences based on some condition and i am using the zlib to read the zipped file.

The input zipped file
01,AB1,CDEF,CHINA,T1, 02,AB2,CDEF,CHINA,T1, 03,AB1,CDEF,JAPAN,T2, 04,AB2,CDEF,JAPAN,T2, 05,AB3,CDEF,JAPAN,T2, 06,AB4,CDEF,JAPAN,T2, 07,AB3,CDEF,CHINA,T1, 08,AB4,CDEF,CHINA,T1, 09,AB1,CDEF,CHINA,T1, 10,AB2,CDEF,CHINA,T1, 11,AB1,CDEF,JAPAN,T2, 12,AB2,CDEF,JAPAN,T2, 13,AB3,CDEF,JAPAN,T2, 14,AB4,CDEF,JAPAN,T2, 15,AB3,CDEF,CHINA,T1, 16,AB4,CDEF,CHINA,T1,
$handle = IO::Zlib->new( "$file", 'rb' ) or die "Zlib failed for $file +"; $result{$_}++ for map { join '|', ( split /\|/ )[4] } <$handle>; print Dumper(%result);

Output what i am getting

$VAR1 = 'T1'; $VAR2 = 8; $VAR3 = ''; $VAR4 = 2; $VAR5 = 'T2'; $VAR6 = 8;

output what I am Expecting is

AB1 --> T1 --> 2 AB2 --> T1 --> 2 AB1 --> T2 --> 2 AB2 --> T2 --> 2 AB3 --> T2 --> 2 AB4 --> T2 --> 2 AB3 --> T1 --> 2 AB4 --> T1 --> 2

Any ideas on this is helpful


In reply to How to read zipped file in perl by Perlseeker_1

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.