Welcome to the Monastery | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Dear monks,
A few minutes ago I needed to "fold" an array into a hash representing a bag/set. That is, from [a, b, c] I wanted to create {a => 1, b => 1, c => 1}. Without thinking much, I slapped:
And now I wonder on the merits of this technique. I recall seeing it discussed in the monastery before, I can't don't know what to look for in the Supersearch. Any fellow monks with memory better than mine ? What I want to know, basically, is whether it's a Good Way (TM), what are the alternatives, etc. In reply to Using map to create a hash/bag from an array by spurperl
|
|