use strict;
use warnings;
####
open(file1,"file1.txt") || die ("cannot open file");
####
open my $file1, '<', "file1.txt" or
die "Can't open `file1.txt': $!\n";
####
while ()
{
chop();
####
$REC = $_;
@LINEREC = split(/\,/,$REC);
$data1 = @LINEREC[0];
####
while (<$file1>)
{
chomp;
my $data1 = (split /,/)[0];
# ...
####
open(file2,"file2.txt") || die ("cannot open file");
####
#!/usr/bin/perl -l
use strict;
use warnings;
my ($fh1, $fh2) = map {
open my $fh, '<', $_ or
die "Can't open `$_': $!\n";
$fh } qw/file1.txt file2.txt/;
while (<$fh1>)
{
chomp;
my $data1 = (split /,/)[0];
seek $fh2, 0, 0;
while (<$fh2>) {
chomp;
print $data1 if
$data1 eq (split /,/)[1];
}
}
__END__