in reply to Filling a Hash

You keep overwriting the hash in your loop. Also, you likely want a hash-of-arrays (perldsc) since you have multiple domains per customer:
use warnings; use strict; my %customer_domain_hash; while (my $line = <DATA>) { chomp $line; my ($k, $v) = split(/@@@/, $line); push @{ $customer_domain_hash{$k} }, $v; } use Data::Dumper; $Data::Dumper::Sortkeys=1; print Dumper(\%customer_d +omain_hash); __DATA__ CustomerA@@@DomainA CustomerA@@@DomainB CustomerA@@@DomainC CustomerA@@@DomainD CustomerA@@@DomainE CustomerB@@@DomainA CustomerB@@@DomainB CustomerB@@@DomainC CustomerB@@@DomainD CustomerB@@@DomainE

Outputs:

$VAR1 = { 'CustomerA' => [ 'DomainA', 'DomainB', 'DomainC', 'DomainD', 'DomainE' ], 'CustomerB' => [ 'DomainA', 'DomainB', 'DomainC', 'DomainD', 'DomainE' ] };