"Do you need the hashes to different instances with same content?"
If I understand your question correctly, then yes. See example in update #2 of my original post. It's a hash of a hash and the inner hashes have the same keys and values (for a given line of input data).
After some more experimenting, since multiplying the right hand side (e.g. with 'x2') is not going to work (the reason for which still isn't clear to me), then what would be wrong with this kind of strategy: Multiply a string first then eval it:
At least it seems to do what's required. I know there's a trailing ',' in $val which could easily be removed, but doesn't seem to be causing a problem with the resulting hash.perl -MData::Dump -e '$val="(".("{(a,1),(b,2)},"x2).")";@hash{(key1,ke +y2)} = eval $val;dd $val;dd \%hash' "({(a,1),(b,2)},{(a,1),(b,2)},)" { key1 => { a => 1, b => 2 }, key2 => { a => 1, b => 2 } } # Or more concisely: perl -MData::Dump -e '@hash{(key1,key2)} = eval "(".("{(a,1),(b,2)},"x +2).")";dd \%hash'
In reply to Re^8: Combinations of lists, etc
by tel2
in thread Combinations of lists to a hash
by tel2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |