in reply to Help with a programming problem.

I didn't mean to give such a short answer. You are just learning the language. One problem was in your line for ($count1 = 0; $count1 < $i2; $count++). That should $count1++. You dropped the '1' at the end of the name. This is an example of where, by enabling strict and warnings, perl would have caught the error and reported it to you.

This requires you to declare all the variables in the program. Some of the variables are declared and some are not. You need to declare all of them. Like in the line with the error, you could declare the loop variable, my $count1

for (my $count1 = 0; $count1 < $i2; $count1++)