in reply to Compare 2 files and get data
It's untested...#!/usr/bin/perl use strict; use warnings; use Tie::File; my $file1 = '/path/to/file.txt'; my $file2 = '/path/to/file2.txt'; tie my @lines1,'Tie::File',$file1 or die $!; tie my @lines2,'Tie::File',$file2 or die $!; my @both = grep{my $i = $_; grep{$_ =~ $i}map{(split(/,/,$_))[1]}@line +s2}map{(split(/,/,$_))[0]}@lines1; untie @lines2; untie @lines1; print $_,"\n" for(@both);
|
|---|