DS has asked for the wisdom of the Perl Monks concerning the following question:
and file two :22-28 36 44-49 234 77 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.23 11 21 44 233 26
thanks for any help or adivce on doing this ..for (@fileTow) { for (@fileOne) { if ($_ =~ /(\d+)-(\d+)/) { my ($start, $end) = split(/-/, $_)}; if (($fileTowValue== $_ ) or ( $fileTowValue>= $start) and ( $fileTowV +alue<= $end)) {print"$fileTowValue\n"}; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: comparing
by gav^ (Curate) on Jul 22, 2002 at 04:49 UTC | |
by DS (Acolyte) on Jul 22, 2002 at 13:45 UTC |