perl -wle' use Data::Dumper; my $data = { q/foo@t-online.example/ => 1, q/foo@-online.example/ => 1, }; my $domain = "-online.example"; foreach my $email (keys %$data) { if ($email =~ m/\@$domain$/) { delete $data->{$email}; } } print Dumper $data;' $VAR1 = { 'foo@t-online.example' => 1 };