Thanks for that, LanX,

"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:

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'
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.

In reply to Re^8: Combinations of lists, etc by tel2
in thread Combinations of lists to a hash by tel2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.