in reply to Re^3: array in hashes
in thread array in hashes
thank you for your helps.
#!/usr/bin/perl -w use strict; my %genome1 = ( a => [ 10, 15 ], b => [ 3, 7 ], c => [ 9, 14 ], ); my %genome2 = ( d => [ 3, 21 ], a => [ 3, 4 ], g => [ 5, 10 ], b => [ 2, 7 ], ); for (keys(%genome1)) { if ($genome2{$_}) { print("$genome1{$_} and $genome2{$_}\n"); } }
we have a in each of hashes (3,4) and (10,15).i want to calculate the slope of the line between (3,4) and (10,15), it means (15-4)/(10-3) or for b we have (2,7) and (3,7),i want (7-7)/(3-2) as output.m=(y2-y1)/(x2-x1).but i dont know how i have to define x and y for numbers in hashes.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: array in hashes
by moritz (Cardinal) on Jul 29, 2011 at 09:54 UTC | |
|
Re^5: array in hashes
by fisher (Priest) on Jul 29, 2011 at 10:07 UTC | |
by JavaFan (Canon) on Jul 29, 2011 at 10:19 UTC | |
by AnomalousMonk (Archbishop) on Jul 29, 2011 at 15:37 UTC | |
by fisher (Priest) on Jul 29, 2011 at 14:02 UTC | |
by JavaFan (Canon) on Jul 29, 2011 at 14:55 UTC | |
by persianswallow (Novice) on Jul 29, 2011 at 10:44 UTC |