Your updated solution fails for "sample:0", which seems to be a likely input given the samples provided by the OP.
But this is sth. I'd like the OP to have figured out ...
Given your three failed attempts, it could very well be out of the reach of the OP.
In reply to Re^4: create hash with map
by ikegami
in thread create hash with map
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |