in reply to Count the Duplicate Entries and make them uniq

Here's another option:

use Modern::Perl; my %hash; map { /(.+)?,(.+)/; $hash{$1}{$2}++ } <DATA>; say 'OS,RELEASE,Yes,No'; say "$_," . ( $hash{$_}{Yes} || 0 ) . ',' . ( $hash{$_}{No} || 0 ) for sort keys %hash; __DATA__ Ubuntu,Warty,No Ubuntu,Hoary,No Ubuntu,Breezy,Yes Ubuntu,Breezy,Yes Fedora,Yarrow,Yes Fedora,Stentz,No Fedora,Yarrow,Yes Fedora,Yarrow,Yes Windows,XP PRO,Yes Windows,XP PRO,Yes Windows,XP Home,No Windows,XP PRO,Yes

Output:

OS,RELEASE,Yes,No Fedora,Stentz,0,1 Fedora,Yarrow,3,0 Ubuntu,Breezy,2,0 Ubuntu,Hoary,0,1 Ubuntu,Warty,0,1 Windows,XP Home,0,1 Windows,XP PRO,3,0

Replies are listed 'Best First'.
Re^2: Count the Duplicate Entries and make them uniq
by slayedbylucifer (Scribe) on Aug 30, 2012 at 04:22 UTC
    Hello Kenosis, Thanks for your respose. your suggestion is shorted thant other solutions on this thread. However, for the time being, I am good with the solution proviede by philiprbrenan. However, i will definitely explore what you ahve sugested as it is totally new for me and it will be a great learning for me.
      Please excuse the my typos.

      You're most welcome! philiprbrenan's solution is certainly a good one, indeed!