my %count_hash; for my $line (@data) { $count_hash{$line} ++; }