my $count2=0; while ($array[1] =~ /$substring/g) {$count2++;}