foreach my $x ( 10..99 ) { foreach my $y ( 10..999 ) { @result = reverse split //, $x*$y; $fr[ $_ ][ $result[$_] ]++ foreach (0..$#result); } }