my %hash = map {($_=>1)} qw(shave the modern way);Hurrah for this solution! One minor note: Since map evaluates the 'mapping block' in list context (as opposed to grep, incidentally), you can shave off two characters by omitting the parentheses.
UPDATE: Thanks to betterworld for pointing out that, if map didn't already evaluate its mapping block in list context, then the parentheses wouldn't help.
In reply to Re^4: Effeciency of key-only hash
by JadeNB
in thread Effecicncy of key-only hash
by brycen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |