⭐ in reply to How do I use a hash as a set?
my %fruit;
@fruit{qw/apple orange banana/} = ();
warn "I know how to defend myself\n"
if exists $fruit{banana};
Note that the actual values stored here are undef. But in any case we just want to know if the key is there or not.
|
|---|