in reply to finding all combinations

Also, your loop comparison should be $i <= $#array1 or $i < @array1, not $i <= $array1, which tries to compare $i to some (probably newly created) scalar $array1.

Strong Suggestion: always use warnings; and use strict;, which would have alerted you to some, at least, of the errors noted.

Another Suggestion: try using the Perl-style rather than the C-style for loop:

for my $i (@array1) { for my $j (@array2) { ... } }