in reply to keeping variables separate

In this scenario, we really need to see the code that stores your values in %ship_address. My guess is that there are keys which used for some subset of all cases (like perhaps floor) and your set statements are going through the new keys, leaving any unused keys with their original value. This can be simply resolved by explicitly initializing %ship_address to an empty list. So

my %ship_address; foreach (@customers) { while (@list) { my $key = shift @list; my $value = shift @list; $ship_address{$key} = $value } # And process... }

should be

my %ship_address; foreach (@customers) { %ship_address = (); while (@list) { my $key = shift @list; my $value = shift @list; $ship_address{$key} = $value } # And process... }