Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: iterations in a hash

by BrowserUk (Pope)
on Aug 04, 2013 at 15:06 UTC ( #1047800=note: print w/ replies, xml ) Need Help??


in reply to iterations in a hash

That is an inherently recursive process:

sub crossMul{ my( $r, $first ) = ( shift, shift ); print "$first * $_ = ", $r->{$first} * $r->{$_} for @_; crossMul( $r, @_ ) if @_ > 1; };; %hash=( A=>4, B=>5, C=>10, D=>2, E=>9 );; crossMul( \%hash, sort keys %hash );; A * B = 20 A * C = 40 A * D = 8 A * E = 36 B * C = 50 B * D = 10 B * E = 45 C * D = 20 C * E = 90 D * E = 18

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re: iterations in a hash
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1047800]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (15)
As of 2014-12-22 20:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (130 votes), past polls