use strict; use warnings; use List::MoreUtils qw(pairwise); my @AoA_first = ( [qw(a b c)], [qw(d e f)], ); my @AoA_second = ( [qw(1 2 3)], [qw(4 5 6)], ); for my $i ( 0 .. $#AoA_first ) { my $row_first = $AoA_first[$i]; my $row_second = $AoA_second[$i]; open my $TEMP, '>', "TMPFILES/$i.tmpfile" or die "Cannot open $i.tmpfile"; print {$TEMP} pairwise {"$a\t$b\n"} @$row_first, @$row_second; close $TEMP; }