Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Nested Cycle?

by TJPride (Pilgrim)
on Mar 02, 2012 at 17:53 UTC ( [id://957523]=note: print w/replies, xml ) Need Help??


in reply to Nested Cycle?

use strict; use warnings; my $w1 = 'name1'; my $w2 = 'name2'; my $hash = { 'name1' => [ 'property1,8.8016', 'property2,4.5016', 'property3,4.0873', 'property4,7.0726', 'property5,9.5121' ], 'name2' => [ 'property6,5.6217', 'property2,4.7993', 'property7,4.2885', 'property3,11.1250' ], 'name3' => [ 'property8,5.6217', 'property2,4.7993', 'property1,4.2885', 'property9,11.1250' ] }; my %sums; for (@{$hash->{$w2}}) { @_ = split /,/; $sums{$_[0]} = $_[1]; } for (@{$hash->{$w1}}) { @_ = split /,/; print "$_[0] = $_[1] + $sums{$_[0]} = " . ($_[1] + $sums{$_[0]}) . + "\n" if $sums{$_[0]}; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-19 21:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found