#!/usr/bin/env perl use 5.010; use strict; use warnings; my @test_sites = qw{x.com y.com www.z.com www.y.com}; check_junk($_) for @test_sites; sub KnownJunkSite { my ($key) = @_; state $is_junksite = { map +($_, 1), qw{ x.com www.x.com z.com www.z.com } }; return exists $is_junksite->{$key} ? 1 : 0; } sub check_junk { my ($key) = @_; say "$key: ", KnownJunkSite($key); } #### x.com: 1 y.com: 0 www.z.com: 1 www.y.com: 0