@array = (); $NAME = "$ARGV[0]"; #FILE 1. open NAME or die "No file 0B $NAME\n"; $NAME1 = "$ARGV[1]"; #FILE 2. open NAME1 or die "No file C0 $NAME1\n"; @array = ; $cc = scalar @array; #FILE 1 array. @AoA = (); for $i ( 0 .. $cc ) { $line = <>; $line =~ s/=/ /g; chomp $line; $AoA[$i] = [ split ' ', $line ]; } #FILE 2 array. @temp = ; $cd = scalar @temp; @AoB = (); for $k ( 0 .. $cd ) { $line2 = $temp[$k]; $line2 =~ s/=/ /g; chomp $line2; $AoB[$k] = [ split ' ', $line2 ]; } close NAME; close NAME1; @NEW = (); $x = 0; $y = 0; for $aref ( @AoA) { for $bref (@AoB) { if ($aref[-1] eq $bref[0]) { my $z = 0; foreach $AoA (@AoA) { push @{ $NEW[$y] }, $aref[$z]; $z++; } push @{ $NEW[$y] }, $bref[-1]; $y++; } else {} } } open (OUTFILE, ">V"); print OUTFILE \@NEW; close OUTFILE;