Here's one I haven't been able to find an answer to. I have 4 arrays:

@array1, @array2, @array3, @array4. I ran code to compare the values of 2 arrays to see number of values in common:

```
use strict;
use warnings;
my (%union, %intersect);
foreach my $e (@array1, @array2) {
$union{$e}++ && $intersect{$e}++
}
my @intersect = sort keys %intersect;
print FILEOUT "@intersect\n";
print FILEOUT scalar @intersect;
```

I was thinking, if I wanted to compare all pairs of arrays and values they had in common, I could create a loop that started with @array1 and compared it to each array. In th loop I would make the digit in the array name a variable. For example:

```
use strict;
use warnings;
my (%union, %intersect, $i);
while ($i <6) {
foreach my $e (@array1, @array$i) {
$union{$e}++ && $intersect{$e}++
}
my @intersect = sort keys %intersect;
print FILEOUT "@intersect\n";
print FILEOUT scalar @intersect;
$i++;
}
```

As you probably know already, the @array$i variable doesn't work.

In the end I'm looking to have a grid where I see belwo but was starting witht he basics:

array1 array2 array3 array4

array1 10 5 17 2

array2 5 15 8 1

array3 17 8 14 6

array4 2 1 6 19

I could create an outer loop that would have tha array names each witha variable in the foreach loop.

Thanks-