G'day madM,

Welcome to the monastery.

As others have pointed out, this is a poorly worded question: you tell from all the guesswork and requests for more information. Better questions get better answers: "How do I post a question effectively?" explains how to achieve this.

Here's my take on a solution:

$ perl -Mstrict -Mwarnings -E ' my %hash = (A => 4, B => 5, C => 10, D => 2, E => 9); local $" = "\t"; for my $key (sort keys %hash) { say "@{[map { qq{$key * $_ = } . $hash{$key} * $hash{$_} } sort grep { $_ ne $key } keys %hash]}" } ' A * B = 20 A * C = 40 A * D = 8 A * E = 36 B * A = 20 B * C = 50 B * D = 10 B * E = 45 C * A = 40 C * B = 50 C * D = 20 C * E = 90 D * A = 8 D * B = 10 D * C = 20 D * E = 18 E * A = 36 E * B = 45 E * C = 90 E * D = 18

-- Ken


In reply to Re: iterations in a hash by kcott
in thread iterations in a hash by madM

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.