1 2 3 4 5 6
if(mag_ich_nicht($domain)) { delete($domains->{$domain}); foreach my $email (keys %$data) { if ($email =~ m/\@$domain$/) { delete($data->{$email}); } } }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
};
2009-08-25T11:32:56 pqgenereller tip: schreib statt m/\@$domain$/ besser m/\@\Q$domain\E$/
1
2
if ( length($email)-length($domain)>=0 && rindex($email,"\@$domain")==length($email)-length($domain) )
{ delete($data->{$email}); }
1
2
3
if ( substr( $email, - length($domain) - 1 ) eq '@' . $domain ) {
delete $data->{$email};
}