The repeat operator (x) can be used with hash slices to get an easy to read set representation:
my @fruit_set = qw/apple banana orange mango/; my @vegie_set = qw/onion tomato lettuce eggplant/; my (%fruit, %vegetable); @fruit{@fruit_set} = (1) x @fruit_set; @vegetable{@vegie_set} = (1) x @vegie_set;
In reply to Re: How do I use a hash as a set?
by CharlesClarkson
in thread How do I use a hash as a set?
by vroom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |