do you know a right way of doing this :
I have file one with this info
22-28
36
44-49
234
77
26
and file two :
23
11
21
44
233
26
I need to see if any number or numbers in file one matches a number in file two or if there is number in file two that is in the range of a number in file one . If there is , then print it ...
for example ,, in my files I would print 26 since it appears in both file and 23 since it is in the range of 22-28
I am doing somthing like this but don't seem to get the ones in the range.
for (@fileTow)
{
for (@fileOne)
{
if ($_ =~ /(\d+)-(\d+)/) { my ($start, $end) = split(/-/, $_)};
if (($fileTowValue== $_ ) or ( $fileTowValue>= $start) and ( $fileTowV
+alue<= $end)) {print"$fileTowValue\n"};
}
}
thanks for any help or adivce on doing this ..
In reply to comparing
by DS
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.