given ($address) { when (@whitelist) { $score -= 30 } when (@blacklist) { $score += 50 } when (/example\.com$/) { $score = 0 } default { ... } } #### for my $a ($address) { if (grep $_ eq $a, @whitelist) { $score -= 30; last; } if (grep $_ eq $a, @blacklist) { $score += 50; last; } if ($a =~ /example\.com$/) { $score = 0; last; } ... }