Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: compare third column of one file with the first column of another

by pme (Monsignor)
on May 06, 2016 at 09:20 UTC ( [id://1162338]=note: print w/replies, xml ) Need Help??


in reply to compare third column of one file with the first column of another

Hi AM,

this little piece of code might help.

use strict; use warnings; open my $m, '<', 'mapped.txt' or die 'Cannot open mapped.txt'; while (<$m>) { chomp; my @l = split /\|/; open my $p, '<', 'ptt.txt' or die 'Cannot open ptt.txt'; while (<$p>) { next if /^Location/; chomp; my ($range) = split; my ($fm, $to) = split(/\.\./, $range); if ($l[1] >= $fm and $l[1] <= $to) { # here you can set which +column is used to compare print "$l[1] - $_\n"; } } close $p; } close $m;
  • Comment on Re: compare third column of one file with the first column of another
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-18 03:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found