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.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.