my %countries = (); my $foo = "US:New York"; my ($country, $city) = (split /:/, $foo); push @{ $countries{$country} }, $city;