Perlseeker_1 has asked for the wisdom of the Perl Monks concerning the following question:
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 file01,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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to read zipped file in perl
by kcott (Archbishop) on Jan 09, 2014 at 14:49 UTC | |
Re: How to read zipped file in perl
by Anonymous Monk on Jan 09, 2014 at 09:39 UTC | |
Re: How to read zipped file in perl
by Eily (Monsignor) on Jan 09, 2014 at 09:43 UTC | |
Re: How to read zipped file in perl
by Utilitarian (Vicar) on Jan 09, 2014 at 09:41 UTC |