my %foo = map { $_ => 1 } qw[ foo bar baz ]; my $foo = 'foo'; print "\$foo is in the list\n" if ($foo{$foo});